My Journey: "Building a Django To-Do List Application"
After creating a few simple projects using Python, I decided to explore the Django framework, a robust tool for web development. I’m excited to share the journey and the steps I took to complete it.
Why Django?
Django is a high-level Python web framework that promotes rapid development and clean design. Its use and comprehensive documentation made it the perfect choice for someone like me, transitioning from Python scripting to web development.
Steps to Create a Django project : (Ensure you have python installed)
Step 1 : First, create a folder for your project.
Step 2 : Open the command prompt (or terminal on Ubuntu) and navigate to your folder.
Step 3 : Install the virtual environment package using pip command.
Step 4 : Once installed, you can create a virtual environment.
Step 5 : Activate venv.
Step 6 : Then, install Django.
Step 7 : Then create a new Django project. This creates the essential files and folders for your project.
Step 8 : Then navigate the path to a new Django project.
Step 9 : Django projects are divided into smaller modules called apps. To manage tasks, we created an app named tasks.
Step 10 : Run the server to test the application locally.
mkdir todo_list cd todo_list pip install virtualenv py -m venv venv venv/Scripts/activate pip install django django-admin startproject todo cd todo django-admin startapp tasks py manage.py runserver
Visit http://127.0.0.1:8000 in your browser to see your To-Do List in action.
Step 11 : Add a task app to the installed app list in settings file of your to-do.
Step 12 : Set up the database in the same settings file. I used SQLite for this project.
Step 13 : In the models file of the tasks' app, I defined the structure of the task, including fields like title, completed and created.
Step 14 : Run the migrations to apply the model.
python manage.py makemigrations
python manage.py migrate
Lessons learned from this project:
Breaking down tasks into smaller components (models, views, templates) helped streamline the process.
Debugging and fixing errors taught me perseverance and the importance of understanding error messages.
This project reinforced my skills in Python, Django, and deployment, and I’m excited to continue exploring new possibilities with Django.
If you’re interested, check out my GitHub repository here.