如何组织一个相对较大的Flask应用程序? [英] How to organize a relatively large Flask application?
问题描述
我正在构建我的第一个Flask应用程序,我无法弄清楚组织我的应用程序的一个好的,干净的Pythonic方法。
我不想像在他们的例子一样在一个单一的.py文件中。
我希望我的应用程序的每个部分在一个单独的模块中。
什么是组织事情的好方法?
我创建了一个名为 Fbone ,请随时查看和分叉:)
Fbone(Flask bone)是一个Flask(Python微框架)模板/ bootstrap /样板文件应用程序。
$ b
概述
- 精心设计用于使用蓝图的大型项目。
- 与最热门的前端框架集成:jQuery / html5boilerplate / bootstrap。 通过flask-login实现棘手的记住我。
- 通过flask-wtform处理web表单。
- 使用瓶测试和鼻子进行单元测试
- 通过fabric和mod_wsgi轻松部署(包含示例)。
- i18n by flask-babel
btw,我刚刚发现这个
I'm building my first Flask app and I can't figure out a good, clean Pythonic way of organizing my application. I don't want to have everything in a single .py file as in their example. I would like to have each part of my app in a separate module. What would be a good way to organize things?
I have created a Flask boilerplate project called "Fbone", please feel free to check it out and fork :)
Fbone (Flask bone) is a Flask (Python microframework) template/bootstrap/boilerplate application.
Overview
- Well designed for big project using blueprint.
- Integrate with hottest frontend framework: jQuery / html5boilerplate / bootstrap.
- Backed by the famous SQLalchemy.
- Implement tricky "remember me" by flask-login.
- Handle web forms by flask-wtform.
- Unit testing with flask-testing and nose.
- Easily deploy via fabric and mod_wsgi (example included).
- i18n by flask-babel
btw, I just found this wiki on building a large project with Flask useful, pls check it!
这篇关于如何组织一个相对较大的Flask应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!