python学习

This commit is contained in:
2019-07-18 08:59:26 +08:00
parent 8ebdee9a2c
commit 7bd7a50cff
347 changed files with 149728 additions and 82 deletions

View File

@@ -4,8 +4,8 @@ from flask_script import Manager
from flask_sqlalchemy import SQLAlchemy
import os
class Application( Flask ):
def __init__(self,import_name):
super( Application,self ).__init__( import_name )
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/%s_setting.py'%os.environ['ops_config'] )
@@ -13,7 +13,13 @@ class Application( Flask ):
db.init_app( self )
db = SQLAlchemy()
app = Application( __name__ )
app = Application( __name__,template_folder=os.getcwd()+"/web/templates/" ,root_path = os.getcwd())
manager = Manager( app )
'''
函数模板
'''
from common.libs.UrlManager import UrlManager
app.add_template_global(UrlManager.buildStaticUrl, 'buildStaticUrl')
app.add_template_global(UrlManager.buildUrl, 'buildUrl')