Skip to content

Commit 75f8b3a

Browse files
committed
init commit
1 parent 4e6e579 commit 75f8b3a

File tree

6 files changed

+1225
-2
lines changed

6 files changed

+1225
-2
lines changed

LICENSE

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2016 leafcoder
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
the Software, and to permit persons to whom the Software is furnished to do so,
10+
subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+40-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,40 @@
1-
# litefs
2-
使用 Python 从零开始构建一个 Web 服务器框架。 开发 Litefs 的是为了实现一个能快速、安全、灵活的构建 Web 项目的服务器框架。 litefs 是一个高性能的 Http 服务器。Litefs 具有高稳定性、丰富的功能、系统消耗低的特点。
1+
2+
1. 快速启动
3+
==============
4+
5+
1.1 启动脚本
6+
---------------
7+
8+
import sys
9+
sys.dont_write_bytecode = True
10+
11+
import litefs
12+
litefs = litefs.Litefs(
13+
address='0.0.0.0:8080', webroot='./site', debug=True
14+
)
15+
litefs.run(timeout=2.)
16+
17+
将上面的代码保存为 run.py 文件。
18+
19+
1.2 页面脚本
20+
---------------
21+
22+
在网站目录(注:启动脚本中 webroot 的目录)中,添加一个后缀名为 **.py** 的文件,如 example.py,代码如下:
23+
24+
def handler(self):
25+
self.start_response(200, headers=[])
26+
return 'Hello world!'
27+
28+
or
29+
30+
def handler(self):
31+
return 'Hello world!'
32+
33+
1.3 启动网站
34+
-----------
35+
36+
$ python run.py
37+
Server is running at 0.0.0.0:8080
38+
Hit Ctrl-C to quit.
39+
40+
运行启动脚本后,访问 http://0.0.0.0:8080/example,您会看到 `Hello world!`

example.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/python
2+
3+
import sys
4+
sys.dont_write_bytecode = True
5+
6+
import litefs
7+
litefs = litefs.Litefs(
8+
address='localhost:9090', webroot='./site', debug=True
9+
)
10+
litefs.run(timeout=2.)

0 commit comments

Comments
 (0)