django
使用Django REST framework
最近在用django做个服务端应用,需要给外部设备开放rest服务,于是开始使用Django REST framework
Django REST framework的官方地址
http://django-rest-framework.org/
1安装
$ sudo easy_install djangorestframework
todo
初学python的Web框架Django-模板
修改django的url规则和模板的基本操作
We’ll just have to take a few steps to make the conversion. We will:
1. Convert the URLconf.
2. Rename a few templates.
3. Delete some of the old, unneeded views.
4. Fix up URL handling for the new views.
初学python的Web框架Django之二-后台管理
一 激活管理界面 Activate the admin site
1 Add “django.contrib.admin” to your INSTALLED_APPS setting.
2 Run python manage.py syncdb. Since you have added a new application to INSTALLED_APPS, the database tables need to be updated.
3 Edit your mysite/urls.py file and uncomment the lines that reference the admin – there are three lines in total to uncomment. This file is a URLconf; we’ll dig into URLconfs in the next tutorial. For now, all you need to know is that it maps URL roots to applications. In the end, you should have a urls.py file that looks like this:
› Continue reading
初学python的Web框架Django
1下载
bear@njava:~$wget http://www.djangoproject.com/download/1.2/tarball/ bear@njava:~$tar -xzvf Django-1.2.tar.gz bear@njava:~$cd Django-1.2/ bear@njava:~$sudo python setup.py install
2 新建django项目
bear@njava:~$ django-admin.py startproject njava bear@njava:~$cd njava bear@njava:~$ls total 20K drwxr-xr-x 2 bear bear 4.0K 2010-05-19 23:27 . drwxr-xr-x 4 bear bear 4.0K 2010-05-19 23:27 .. -rw-r--r-- 1 bear bear 0 2010-05-19 23:27 __init__.py -rw-r--r-- 1 bear bear 546 2010-05-19 23:27 manage.py -rw-r--r-- 1 bear bear 3.3K 2010-05-19 23:27 settings.py -rw-r--r-- 1 bear bear 534 2010-05-19 23:27 urls.py bear@njava:~$python manage.py runserver 0.0.0.0:8000