1. Build project 1) create virtual environment $ mkdir django $ cd django $ python3 -m venv env $ tree -L 2 env/
env
├── bin
│?? ├── Activate.ps1
│?? ├── activate
│?? ├── activate.csh
│?? ├── activate.fish
│?? ├── easy_install
│?? ├── easy_install-3.8
│?? ├── pip
│?? ├── pip3
│?? ├── pip3.8
│?? ├── python -> python3
│?? └── python3 -> /usr/bin/python3
├── include
├── lib
│?? └── python3.8
├── lib64 -> lib
├── pyvenv.cfg
└── share
└── python-wheels
2) activate virtual env $ source env/bin/activate 3) install Django (env)django$ pip install django 4) create project in Django (env)django$ django-admin startproject learning_log . (env)django$ tree learning_log/
learning_log/
├── __init__.py
├── asgi.py
├── settings.py
├── urls.py
└── wsgi.py
5) migrate database (env)django$ python manage.py migrate 6) check project (env)django$ python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
August 14, 2022 - 03:25:03
Django version 4.1, using settings 'learning_log.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
2. create application 1) quit the server and create app facility (env)django$ python manage.py ?startapp learning_logs 2) define models (env)django$ vi learning_logs/models.py 3) activate models
......
For more information please according to <Python Crash Course, 2nd Edition>
Appendix Remote debugging a Django project in Vscode
|