1 Star 0 Fork 19

odit/Python Flask订餐系统

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
application.py 1.01 KB
一键复制 编辑 原始数据 按行查看 历史
张亚飞 提交于 2019-02-25 18:53 +08:00 . 2019-02-25
# -*- coding: utf-8 -*-
"""
@Datetime: 2019/1/29
@Author: Zhang Yafei
"""
import os
from flask import Flask
from flask_script import Manager
from flask_sqlalchemy import SQLAlchemy
from common.libs.UrlManager import UrlManager
class Application(Flask):
def __init__(self, import_name, template_folder=None, root_path=None):
super(Application, self).__init__(import_name, template_folder=template_folder, root_path=root_path, static_folder=None)
self.config.from_pyfile('config/base_setting.py')
if 'ops_config' in os.environ:
self.config.from_pyfile('config/{}_setting.py'.format(os.environ['ops_config']))
db.init_app(self)
db = SQLAlchemy()
app = Application(__name__, template_folder=os.getcwd() + '/web/templates', root_path=os.getcwd())
manager = Manager(app)
"""
函数模板
"""
app.add_template_global(UrlManager.buildStaticUrl, 'buildStaticUrl')
app.add_template_global(UrlManager.buildUrl, 'buildUrl')
app.add_template_global(UrlManager.buildImageUrl, 'buildImageUrl')
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/odit/ordering_system.git
git@gitee.com:odit/ordering_system.git
odit
ordering_system
Python Flask订餐系统
master

搜索帮助