프로젝트 생성
(myvenv) $ django-admin.py startproject mysite .
xdjangogirls├───manage.py└───mysitesettings.pyurls.pywsgi.py__init__.py
설정 변경
mysite/settings.py을 코드 에디터로 열어서 설정을 변경한다.
시간대 변경
xxxxxxxxxxTIME_ZONE = 'Asia/Seoul'정적파일 경로 추가
xxxxxxxxxxSTATIC_URL = '/static/'STATIC_ROOT = os.path.join(BASE_DIR, 'static')DEBUG가 True이고 ALLOWED_HOSTS가 비어 있으면, 호스트는 ['localhost', '127.0.0.1', '[::1]']에 대해서 유효한다. PythonAnywhere의 호스트 이름과 일치시키기 위해 설정을 아래와 같이 변경한다.
xxxxxxxxxxALLOWED_HOSTS = ['127.0.0.1', '.pythonanywhere.com']
데이터베이스 설정
장고에는 기본적으로 sqlite3라는 데이터베이스가 설치되어 있다.
xxxxxxxxxxDATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), }}데이터베이스를 생성하기 위해서 python manage.py migrate 명령을 실행시킨다.
xxxxxxxxxx(myvenv) $ python manage.py migrateOperations to perform:Apply all migrations: auth, admin, contenttypes, sessionsRunning migrations:Rendering model states... DONEApplying contenttypes.0001_initial... OKApplying auth.0001_initial... OKApplying admin.0001_initial... OKApplying admin.0002_logentry_remove_auto_add... OKApplying contenttypes.0002_remove_content_type_name... OKApplying auth.0002_alter_permission_name_max_length... OKApplying auth.0003_alter_user_email_max_length... OKApplying auth.0004_alter_user_username_opts... OKApplying auth.0005_alter_user_last_login_null... OKApplying auth.0006_require_contenttypes_0002... OKApplying auth.0007_alter_validators_add_error_messages... OKApplying sessions.0001_initial... OK
python manage.py runserver 명령어를 실행해 웹 사이트가 작동하는지 확인한다.
xxxxxxxxxx(myvenv) $ python manage.py runserver

'Python > Django' 카테고리의 다른 글
| 장고 걸즈 튜토리얼 따라하기 6 - 장고 urls (0) | 2018.12.24 |
|---|---|
| 장고 걸즈 튜토리얼 따라하기 5 - 배포 (0) | 2018.12.23 |
| 장고 걸즈 튜토리얼 따라하기 4 - 장고 관리자 (0) | 2018.12.19 |
| 장고 걸즈 튜토리얼 따라하기 3 - 장고 model (0) | 2018.12.14 |
| 장고 걸즈 튜토리얼 따라하기 1 - 설치하기 (0) | 2018.12.10 |