Django is a python based framework for web app development.
Install Django
python3 -m pip install DjangoSetting up a project:
django-admin startproject project-nameStarting the dev server:
python3 manage.py runserverCreate an app:
python3 manage.py startapp app-nameMigrate models to the database:
python3 manage.py makemigrations
python3 manage.py migrateDatabases:
- You can set up postgresql database server or a mysql server
- Connect the database to the project by making a change to settings.py
- reset django postgres database
- custom django user model
- Making database queries
Environment variables:
Django Views: Views take in an HttpRequest as a parament and return an HttpResponse. The HttpRequest can contain GET and POST data that can be used when constructing the view or responding to the request.
Django code:
Deployment:
- Deploying an app to production
- Using WhiteNoise with Django - WhiteNoise 6.11.0 documentation - static file serving within django
Django Rest Framework:
Authentication: