a Decorated Python Web FrameWork for study not product
index.py
from muxi import Muxi
from muxi.de import url, views, headers, config
@config(secret_key='xxx')
def create_app():
app = Muxi(__name__)
return app
app = create_app()
@url(app, '/index')
@views('index.html')
@headers(status_code=200)
def index():
return {'name': 'muxi'}
index.html
<html>
<body>
<h1>Hello {{ name }}</h1>
</body>
</html>
muxi is my team name MuxiStudio(木犀团队)
MuxiStudio
(The WTFPL)
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2016 neo1218 (https://github.com/neo1218)
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
这个框架只是一个玩具式的框架, 是为了更好的学习Python后端框架的知识,为了这篇博客编写的。
但是这个框架仍然融合了我的一些思想: 比如装饰器的大量使用...(装饰器大法好)...
我来谈谈我的框架设计吧: