phoenix13

导航

 

https://docs.djangoproject.com/en/1.8/intro/tutorial01/

0. checklist for setup django application

(1) config DB in settings.py

(2) run command to init DB

python manage.py syncdb

http://stackoverflow.com/questions/10515808/django-mysql-no-such-table-aidata-django-session

 

1. get django version

python -c "import django; print(django.get_version())"

2. run server

python manage.py runserver
python manage.py runserver 0.0.0.0:<your_port>

3. create a project

django-admin startproject [project name]

4. create a app

python manage.py startapp [app name]

5. create a migration file (not changing database, just create a file)

 python manage.py makemigrations

  5.1 check sql command for migration file

python manage.py sqlmigrate [app name] [migration number]
python manage.py sqlmigrate polls 0001

 

6. apply migration (update database schema)

 python manage.py migrate

 

posted on 2015-07-28 02:31  phoenix13  阅读(269)  评论(0编辑  收藏  举报