1. Upgrade pip $ Install Django
python -m pip install --upgrade pip
pip --version # Check a pip vesion.
pip install Django
pip install Django --upgrade
python -c "import django; print(django.__path__)" # Check a path of the Django package.
2. A project can consist of many applications
django-admin startproject "project_name"
cd project_name
python manage.py startapp "app_name"
3. Create template folder in each apps.
cd app_name
mkdir templates
4. Edit project's setting.
add application's setting information to var 'INSTALLED_APPS'
-> add "'app_name'.apps.'confing_name'"
if debug is false, input ip address to var ALLOWED_HOSTS
5. Create user account & Run server
python manage.py createsuperuser
python manage.py runserver 0.0.0.0:8000
'Python > Django' 카테고리의 다른 글
virtualenv 가상환경 사용하기 (0) | 2020.05.30 |
---|---|
[django] 1. Home / Basics / Overview (0) | 2019.04.11 |