##install
sudo apt-get install libpq-dev python-dev
sudo apt-get install python-pip
sudo apt-get install postgresql postgresql-client postgresql-server-dev-all
sudo apt-get install pgadmin3
pip install django
pip install djangorestframework
pip install djangorestframework-xml (optional)
pip install psycopg2 (python 连接 postgreSQL使用)
pip install pysimplesoap
pip install defusedxml
##start
django-admin.py startproject tutorial
python manage.py startapp quickstart
##setting.py
##ORM
python manage.py inspectdb > models.py # db -> model.py
python manage.py makemigrations # model.py -> db
python manage.py migrate (取代了旧的python manage.py syncdb)
##Use admin.py
1. python manage.py createsuperuser
2. Register your app in admin.py
from models import User
admin.site.register(User)
3. too see the real name of object
def __unicode__(self):
return self.u_name
##test
python manage.py runserver (ip)
127.0.0.1:8000
##api
##Auth
oauth2.0