Debian/Linux下Django + PostgreSQL环境搭建
2016-03-23 12:54
721 查看
##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
本文出自 “博客” 博客,请务必保留此出处http://zhangxd7.blog.51cto.com/11357018/1754246
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
本文出自 “博客” 博客,请务必保留此出处http://zhangxd7.blog.51cto.com/11357018/1754246
相关文章推荐
- SQLite的架构(The Architecture Of SQLite)
- mysql copy复制拷贝表数据及结构的几种方式(转)
- mysql出现Got error 28 from storage engine错误
- PL/SQL Developer 工具优化
- Mysql在大型网站的应用架构演变
- MySQL数据库的优化-运维架构师必会高薪技能,笔者近六年来一线城市工作实战经验
- mysql审计插件(运维不在背锅)
- .net 中的 SqlBulkCopy 批量插入会锁表吗?
- PLSQL Developer如何连接远程Oracle数据库
- hadoop hive sql语法解释
- 监控mysql 脚本
- vmware 安装openstack,安装mysql,keyston glance,nova
- SQL Server 监控统计阻塞脚本信息
- 转载:SQL Server高效 -- 设计(ITPUT 讨论汇总
- plsql developer 查看执行计划
- mysql服务器监控参数总结
- zabbix监控MySQL备份成功失败
- mysql中OPTIMIZE TABLE的作用
- SQL SERVER-identity | @@identity | scope_identity
- MYSQL企业常用架构与调优经验分享