Building a to-do app with Django


One of the best projects to undertake to learn Django is the to-do app. It teaches you to read and write to databases, about the models, views and templates concepts within Django and all about how to integrate the functionality into a nice user interface.

To run my project, I used a one-click install on Digital Ocean – as I just wanted to get down to coding & wasn’t too bothered about setting up the environment myself. After launching the django one-click deploy Digital Ocean instance, I ran the below commands to star the app; make the directories I was going to require & make sure the deployment was ready for development to begin.

  • cd /home/django/
  • cd django_project/
  • python startapp netshock
  • cd netshock/
  • mkdir templates
  • mkdir authenticate
  • sudo apt-get update
  • systemctl restart gunicorn.service
  • python runserver
  • python makemigrations
  • python migrate
  • python createsuperuser

The full code of the project is below. This code achieved:

  • Login and logout
  • Add new tasks
  • Assign tasks to other users
  • Only see tasks you created or that you’re assigned to
  • Mark tasks as completed and uncomplete them if marked by accident
  • Delete tasks
  • Add notes to tasks
  • View stats on the overall project

The user interfaces are: