Django CLI Commands

To Install Django onto Ubuntu when not using virtual environments:

sudo apt install python3-django

To create the Project:

django-admin startproject PROJECTNAME

To create the App:

python3 manage.py startapp APPNAMECode language: CSS (css)

To run the web server. Using SUDO you can set the server to run on Port 80

python3 manage.py runserverCode language: CSS (css)
sudo python3 manage.py runserver 0.0.0.0:80Code language: CSS (css)

To update the Database from the Models.py file:

python3 manage.py makemigrationsCode language: CSS (css)
python3 manage.py migrateCode language: CSS (css)

To create a Super User account for Django so you can access the GUI web dashboard. Make sure to run makemigrations and migrate at least once even if you haven’t edited the Models.py fiile.

python3 manage.py createsuperuserCode language: CSS (css)