ss
This commit is contained in:
@@ -3,6 +3,7 @@ from flask import Flask
|
||||
from flask_script import Manager
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
|
||||
|
||||
import os
|
||||
class Application( Flask ):
|
||||
def __init__(self,import_name,template_folder=None,root_path = None):
|
||||
@@ -10,7 +11,10 @@ class Application( Flask ):
|
||||
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'] )
|
||||
|
||||
# 设置数据库连接 URI
|
||||
self.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://root:123456@127.0.0.1/food_db?charset=utf8mb4'
|
||||
# 禁用对象修改跟踪
|
||||
self.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
||||
db.init_app( self )
|
||||
|
||||
db = SQLAlchemy()
|
||||
@@ -25,3 +29,7 @@ app.add_template_global(UrlManager.buildStaticUrl, 'buildStaticUrl')
|
||||
app.add_template_global(UrlManager.buildUrl, 'buildUrl')
|
||||
app.add_template_global(UrlManager.buildImageUrl, 'buildImageUrl')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user