Django Polls Simplified — Creating a Django Project
After some long explanations and setting up instructions, we now start writing the Django Polls application.
Since this is a technical article(not a newspaper), all the codes and demos are available on a GitHub repo for reference.
Now we start
Make you activate your virtual environment, where we already installed Django.
On the directory created, run the commands to initialize a Django project:
django-admin startproject config .I use config as the project’s name because it contains all configuration files for my Django project.
This naming convention (e.g., config) is often used to avoid naming conflicts with the main project folder(Feel free to use whatever name you want).
The dot (.) tells Django to create the project in the current directory instead of creating a new directory for it.
This is useful if you already have a folder for your project and want the project files to be directly within it rather than nested under another directory.
Running the Development Server
Run the following commands to start the development server:
python manage.py runserverNow that the server’s running, visit http://127.0.0.1:8000/ with your web browser. You’ll see a “Congratulations!” page, with a rocket taking off. It worked!
You’ve fired up the Django development server — a lean, mean, Python-powered machine! We bundled this lightweight web server with Django to help you build and test your ideas quickly, without diving into the complexities of a production setup like Apache.
But hey, let’s be clear: this little server is the training wheels of web development. It’s here to help you during the development phase, not to handle real-world traffic. When it’s time to go pro, swap it out for a production-grade server. (We craft web frameworks, not fortresses for the internet!)
You can follow along with this project by checking out the corresponding commit:
