Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9f37cad

Browse filesBrowse files
committed
Merge branch 'develop'
2 parents c7e1e0c + a5a6bda commit 9f37cad
Copy full SHA for 9f37cad
Expand file treeCollapse file tree

34 files changed

+1476
-713
lines changed

‎.gitignore

Copy file name to clipboardExpand all lines: .gitignore
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,11 @@ dist/
88
*.egg-info/
99
.eggs/
1010
build/
11+
*.so
12+
.tox/
13+
__pycache__/
14+
*.pyc
15+
*.log
16+
.idea/
17+
docs/_book/
18+
docs/node_modules/

‎.nojekyll

Copy file name to clipboardExpand all lines: .nojekyll
Whitespace-only changes.

‎MANIFEST.in

Copy file name to clipboard
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
include LICENSE requirements.txt
2-
recursive-include demo *.*
1+
include LICENSE requirements.txt example.py README.md
2+
recursive-include site *.*
3+
recursive-include test *.*

‎README.md

Copy file name to clipboard
+34-94Lines changed: 34 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,34 @@
1-
2-
# 1. 快速启动
3-
4-
1.1 启动脚本
5-
---------------
6-
7-
import sys
8-
sys.dont_write_bytecode = True
9-
10-
import litefs
11-
litefs = litefs.Litefs(
12-
address='0.0.0.0:8080', webroot='./site', debug=True
13-
)
14-
litefs.run(timeout=2.)
15-
16-
将上面的代码保存为 run.py 文件。
17-
18-
1.2 页面脚本
19-
---------------
20-
21-
在网站目录(注:启动脚本中 webroot 的目录)中,添加一个后缀名为 **.py** 的文件,如 example.py,代码如下:
22-
23-
def handler(self):
24-
self.start_response(200, headers=[])
25-
return 'Hello world!'
26-
27-
or
28-
29-
def handler(self):
30-
return 'Hello world!'
31-
32-
1.3 启动网站
33-
-----------
34-
35-
$ python run.py
36-
Server is running at 0.0.0.0:8080
37-
Hit Ctrl-C to quit.
38-
39-
运行启动脚本后,访问 http://0.0.0.0:8080/example,您会看到 `Hello world!`
40-
41-
42-
# 2. CGI 规则
43-
44-
2.1 httpfile 对象是服务器上下文接口,接口如下:
45-
--------------------------------------
46-
47-
接口类型 | 接口使用 | 接口描述
48-
---- | --- | ----
49-
环境变量(只读) | httpfile.environ | 环境变量
50-
某环境变量 | httpfile.environ`[`_*envname*_`]` | 获取某环境变量
51-
Session | httpfile.session | session 对象,可临时保存或获取内存数据
52-
Session ID | httpfile.session_id | session 对象 ID,将通过 SET_COOKIE 环境变量返回给客户端浏览器
53-
Form | httpfile.form | form 为字典对象,保存您提交到服务器的数据
54-
Config | httpfile.config | 服务器的配置对象,可获取初始化服务器的配置信息
55-
files | httpfile.files | 字典对象,保存上传的文件,格式为:{ *filename1*: *\<StringIO object\>*, *filename2*: *\<StringIO object\>* }
56-
cookie | httpfile.cookie | SimpleCookie 对象,获取 Cookie 数据
57-
页面跳转 | httpfile.redirect(url=None) | 跳转到某一页面
58-
HTTP头部 | httpfile.start_response(status_code=200, headers=None) | HTTP 返回码和头部
59-
60-
2.2 以下为 httpfile 对象中环境变量(environ)包含的变量对应表
61-
---------------------------------------------------
62-
63-
环境变量 | 描述 | 例子
64-
------- | ------ | ----
65-
REQUEST_METHOD | 请求方法 | GET、POST、PUT、HEAD等
66-
SERVER_PROTOCOL | 请求协议/版本 | HTTP/1.1"
67-
REMOTE_ADDR | 请求客户端的IP地址 | 192.168.1.5
68-
REMOTE_PORT | 请求客户端的端口 | 9999
69-
REQUEST_URI | 完整 uri | /user_info?name=li&age=20
70-
PATH_INFO | 页面地址 | /user_info
71-
QUERY_STRING | 请求参数 | name=li&age=20
72-
CONTENT_TYPE | POST 等报文类型 | application/x-www-form-urlencoded 或 text/html;charset=utf-8
73-
CONTENT_LENGTH | POST 等报文长度 | 1024
74-
HTTP_*_HEADERNAME_* | 其他请求头部 | 如 HTTP_REFERER:https://www.baidu.com/
75-
76-
2.3 部分环境变量也可以使用 httpfile 属性的方式获取
77-
------------------------------------------
78-
79-
环境变量 | 对应属性
80-
------- | -------
81-
PATH_INFO | httpfile.path_Info
82-
QUERY_STRING | httpfile.query_string
83-
REQUEST_URI | httpfile.request_uri
84-
REFERER | httpfile.referer
85-
REQUEST_METHOD | httpfile.request_method
86-
SERVER_PROTOCOL | httpfile.server_protocol
87-
88-
# 3. Mako 文件支持
89-
90-
TODO
91-
92-
# 4. CGI 支持
93-
94-
TODO
1+
<div align="center">
2+
3+
# Litefs
4+
5+
<p>
6+
<!-- Place this tag where you want the button to render. -->
7+
<a class="github-button" href="https://github.com/leafcoder/litefs/subscription" data-color-scheme="no-preference: light; light: light; dark: dark;" data-show-count="true" aria-label="Watch leafcoder/litefs on GitHub">
8+
<img alt="GitHub forks" src="https://img.shields.io/github/watchers/leafcoder/litefs?style=social">
9+
</a>
10+
<a class="github-button" href="https://github.com/leafcoder/litefs" data-color-scheme="no-preference: light; light: light; dark: dark;" data-show-count="true" aria-label="Star leafcoder/litefs on GitHub">
11+
<img alt="GitHub forks" src="https://img.shields.io/github/stars/leafcoder/litefs?style=social">
12+
</a>
13+
<a class="github-button" href="https://github.com/leafcoder/litefs/fork" data-color-scheme="no-preference: light; light: light; dark: dark;" data-show-count="true" aria-label="Fork leafcoder/litefs on GitHub">
14+
<img alt="GitHub forks" src="https://img.shields.io/github/forks/leafcoder/litefs?style=social">
15+
</a>
16+
</p>
17+
18+
<p>
19+
<img src="https://img.shields.io/github/v/release/leafcoder/litefs" data-origin="https://img.shields.io/github/v/release/leafcoder/litefs" alt="GitHub release (latest by date)">
20+
<img src="https://img.shields.io/github/languages/top/leafcoder/litefs" data-origin="https://img.shields.io/github/languages/top/leafcoder/litefs" alt="GitHub top language">
21+
<img src="https://img.shields.io/github/languages/code-size/leafcoder/litefs" data-origin="https://img.shields.io/github/languages/code-size/leafcoder/litefs" alt="GitHub code size in bytes">
22+
<img src="https://img.shields.io/github/commit-activity/w/leafcoder/litefs" data-origin="https://img.shields.io/github/commit-activity/w/leafcoder/litefs" alt="GitHub commit activity">
23+
<img src="https://img.shields.io/github/downloads/leafcoder/litefs/total" data-origin="https://img.shields.io/github/downloads/leafcoder/litefs/total" alt="GitHub All Releases">
24+
</p>
25+
26+
</div>
27+
28+
Litefs is a lite python web framework.
29+
30+
Build a web server framework using Python. Litefs was developed to implement
31+
a server framework that can quickly, securely, and flexibly build Web
32+
projects. Litefs is a high-performance HTTP server. Litefs has the
33+
characteristics of high stability, rich functions, and low system
34+
consumption.

‎TODO.md

Copy file name to clipboard
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
* WSGI 支持
2+
* HTTP Method 限制
3+
* 更多的 HTTP 错误页
4+
* cookies 属性
5+
* query 参数和 post 参数分为不同的属性
6+
* 数据库模块
7+
* 搜索模块
8+
* 配置模块
9+
* 尝试整个框架不依赖其他模块来实现

‎demo/example.py

Copy file name to clipboardExpand all lines: demo/example.py
-11Lines changed: 0 additions & 11 deletions
This file was deleted.

‎demo/site/environ.py

Copy file name to clipboardExpand all lines: demo/site/environ.py
-2Lines changed: 0 additions & 2 deletions
This file was deleted.

‎demo/site/form.html

Copy file name to clipboardExpand all lines: demo/site/form.html
-23Lines changed: 0 additions & 23 deletions
This file was deleted.

‎demo/site/form.py

Copy file name to clipboardExpand all lines: demo/site/form.py
-3Lines changed: 0 additions & 3 deletions
This file was deleted.

‎demo/site/index.html.py

Copy file name to clipboardExpand all lines: demo/site/index.html.py
-11Lines changed: 0 additions & 11 deletions
This file was deleted.

‎demo/site/upload.html

Copy file name to clipboardExpand all lines: demo/site/upload.html
-17Lines changed: 0 additions & 17 deletions
This file was deleted.

‎demo/site/upload.py

Copy file name to clipboardExpand all lines: demo/site/upload.py
-4Lines changed: 0 additions & 4 deletions
This file was deleted.

‎demo/site/user-agent.py

Copy file name to clipboardExpand all lines: demo/site/user-agent.py
-7Lines changed: 0 additions & 7 deletions
This file was deleted.

‎docs/.nojekyll

Copy file name to clipboardExpand all lines: docs/.nojekyll
Whitespace-only changes.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.