Django Tutorial
Here summarize Django tutorial link, commonly used commands and some other things to notice.
-
Beginner friendly tutorial: https://www.w3schools.com/django/
- Commonly used commands: You can refer to this doc for more information.
- Create a project
> django-admin startproject project_name
- Create an app in a project
> python manage.py startapp app_name
- Run the server:
> python manage.py runserver # default port is 8000 > python manage.py runserver 8080
- Create/Update migration files based on the changes detected to your models.
> python manage.py makemigrations app_label
- Migrate: Synchronizes the database state with the current set of models and migrations.
> python manage.py migrate
- Prints the SQL for the named migration:
> python manage.py sqlmigrate app_label migration_name
- Starts the Python interactive interpreter. You can insert/update/delete data through it.
> python manage.py shell
- WSGI vs ASGI