Skip to content

Commit 8dc5cdd

Browse files
committed
Refactor docs
1 parent 874c16f commit 8dc5cdd

File tree

9 files changed

+484
-297
lines changed

9 files changed

+484
-297
lines changed

docs/auth.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
第三方认证接入
2+
====================
3+
4+
新浪微博
5+
----------
6+
7+
.. literalinclude:: ../examples/weibo/1/appstack.py
8+
9+
请参阅 examples/weibo 。
10+

docs/dev_server.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
简陋的本地测试服务器
1+
dev_server
22
===========================
33

44
注意:本工具仅为应用开发便利之用,与真实的sae环境相差较大。

docs/framework.rst

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
Web开发框架
2+
================
3+
4+
Django
5+
--------------
6+
7+
NOTE: 目前SAE Python使用的版本是 *Django-1.2.7* , 请确保你安装的是这个版本。
8+
9+
1. 建立一个新的Python应用mysite
10+
11+
2. 检出SVN代码到本地目录
12+
13+
3. 新建文件index.wsgi,内容如下
14+
15+
.. literalinclude:: ../examples/pythondemo/1/index.wsgi
16+
17+
4. 初始化django应用
18+
19+
::
20+
21+
django-admin.py startproject mysite
22+
23+
5. 从django安装目录复制admin 的media目录
24+
25+
::
26+
27+
cp -rf django/contrib/admin/media/ .
28+
29+
去除.svn 目录::
30+
31+
find . -type d -name ".svn"|xargs rm -rf
32+
33+
目录结构如下::
34+
35+
jaime@westeros:~/source/chenfeng/pythondemo/1$ ls
36+
index.wsgi media mysite README
37+
jaime@westeros:~/source/chenfeng/pythondemo/1$ ls media/
38+
css img js
39+
jaime@westeros:~/source/chenfeng/pythondemo/1$ ls mysite/
40+
demo __init__.py manage.py settings.py urls.py views.py
41+
jaime@westeros:~/source/chenfeng/pythondemo/1$
42+
43+
6. 提交代码
44+
45+
访问 `http://mysite.sinaapp.com` ,就可看到Django的欢迎页面了。
46+
47+
7. Hello, Django!
48+
49+
在mysite/目录下新建一个views.py,内容如下
50+
51+
.. literalinclude:: ../examples/pythondemo/1/mysite/views.py
52+
53+
修改urls.py,新增一条规则解析hello,同时打开admin的注释::
54+
55+
# Uncomment the next two lines to enable the admin:
56+
from django.contrib import admin
57+
admin.autodiscover()
58+
59+
urlpatterns = patterns('',
60+
...
61+
(r'^$', 'mysite.views.hello),
62+
(r'^admin/', include(admin.site.urls)),
63+
)
64+
65+
66+
在setttings.py中开启admin组件::
67+
68+
INSTALLED_APPS = (
69+
'django.contrib.auth',
70+
'django.contrib.contenttypes',
71+
...
72+
# Uncomment the next line to enable the admin:
73+
'django.contrib.admin',
74+
# Uncomment the next line to enable admin documentation:
75+
# 'django.contrib.admindocs',
76+
)
77+
78+
79+
提交代码,访问 `http://mysite.sinaapp.com/`
80+
81+
Django 数据库配置见 MySQL 节。
82+
83+
84+
Flask
85+
-------------
86+
87+
index.wsgi
88+
89+
.. literalinclude:: ../examples/pythondemo/2/index.wsgi
90+
91+
myapp.py
92+
93+
.. literalinclude:: ../examples/pythondemo/2/myapp.py
94+
95+
http://2.pythondemo.sinaapp.com/demo
96+
97+
98+
Bottle
99+
--------------
100+
101+
index.wsgi
102+
103+
.. literalinclude:: ../examples/pythondemo/3/index.wsgi
104+
105+
http://3.pythondemo.sinaapp.com
106+
107+
108+
Tornado
109+
---------------
110+
111+
index.wsgi
112+
113+
.. literalinclude:: ../examples/pythondemo/4/index.wsgi
114+
115+
http://4.pythondemo.sinaapp.com
116+

docs/index.rst

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,20 @@ Git: https://github.com/SAEPython/saepythondevguide
1818
打包下载: https://github.com/SAEPython/saepythondevguide/zipball/master
1919

2020
Contents:
21-
21+
2222
.. toctree::
2323
:maxdepth: 2
24-
25-
manual
26-
sae
27-
dev_server
24+
25+
quickstart
26+
runtime
27+
framework
28+
service
29+
auth
30+
other
2831

2932

30-
意见反馈:
33+
意见反馈
34+
=============
3135

3236
http://sae.sina.com.cn/?m=feedback
3337

0 commit comments

Comments
 (0)