File tree Expand file tree Collapse file tree 1 file changed +108
-0
lines changed Expand file tree Collapse file tree 1 file changed +108
-0
lines changed Original file line number Diff line number Diff line change 1+ .. _tutorial :
2+
3+ ===================================
4+ 应用开发教程
5+ ===================================
6+
7+ STEP0: 熟悉项目目录结构
8+ -----------------------------------
9+
10+
11+
12+ STEP2: 启动开发服务器
13+ -----------------------------------
14+
15+ dev.sh
16+
17+ restart.sh
18+
19+
20+
21+ STEP1: 创建项目所需文件
22+ -----------------------------------
23+
24+ app 目录& `__init__.py `
25+
26+ _env.py
27+
28+ _route.py
29+
30+ root.py
31+
32+ j.py
33+
34+
35+
36+ STEP3: 配置路由&编写视图
37+ -----------------------------------
38+
39+ View 与 `tornado.web.RequestHandler `
40+
41+ \@ route
42+
43+ root.py ::
44+
45+ @route
46+ class hello_world(View):
47+ def get(self):
48+ o = 'world'
49+ self.render()
50+
51+
52+
53+ STEP3: 第一个 Mako 文件
54+ -----------------------------------
55+
56+ mako ::
57+
58+ <h1>Hello, ${ o }</h1>
59+
60+
61+
62+ STEP3: 第一个 SCSS/SASS 文件
63+ -----------------------------------
64+
65+ SCSS ::
66+
67+ $font-stack: Helvetica, sans-serif;
68+ $primary-color: #333;
69+
70+ body {
71+ font: 100% $font-stack;
72+ color: $primary-color;
73+ }
74+
75+ nav {
76+ ul {
77+ margin: 0;
78+ padding: 0;
79+ list-style: none;
80+ }
81+
82+ li { display: inline-block; }
83+
84+ a {
85+ display: block;
86+ padding: 6px 12px;
87+ text-decoration: none;
88+ }
89+ }
90+
91+
92+ STEP3: 第一个 CoffeeScript 文件
93+ -----------------------------------
94+
95+ CoffeeScript ::
96+
97+ ->
98+ alert 'Hello World!'
99+
100+
101+ STEP3: 重启开发服务器
102+ -----------------------------------
103+
104+ 添加 CoffeeScript/JavaScript/CSS/SASS/SCSS 文件后需要手动重启服务器:
105+
106+ 1. 结束当前 dev.sh
107+
108+ 2. 运行 dev.sh
You can’t perform that action at this time.
0 commit comments