def configured_app(): app = Flask(__name__) app.config['SECRET_KEY'] = 'asdfgh' app.register_blueprint(main_blueprint) socketio.init_app(app) return app
def create_app(): app = Flask(__name__) app.config['SECRET_KEY'] = SECRET_KEY app.register_blueprint(main_blueprint) socketio.init_app(app) return app
def configured_app(): app = Flask(__name__) app.config['SECRET_KEY'] = secret.secret_key app.debug = True app.register_blueprint(main_blueprint) socketio.init_app(app) return app
def create_app(): app = Flask(__name__) app.config.from_object(DevelopmentConfig) socketio.init_app(app) from views import app as application app.register_blueprint(application) return app
def configured_app(): """ app配置函数, 用于配置Flask主程序的路由蓝图, 数据库等 :return: app N """ server = Flask(__name__) # 注册路由蓝图 server.register_blueprint(public) server.register_blueprint(weibo) server.register_blueprint(api_weibo) server.register_blueprint(user_route) server.register_blueprint(chats) socketio.init_app(server) return server
def configured_app(): app = Flask(__name__) # 设置 secret_key 来使用 flask 自带的 session # 这个字符串随便你设置什么内容都可以 app.secret_key = config.secret_key app.config[ 'SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://root:{}@localhost/web19?charset=utf8mb4'.format( secret.database_password) db.init_app(app) # module = __import__('routes.index') # b = getattr(getattr(module, 'index'), 'blueprint')() # log('index blueprint', b) # app.register_blueprint(b) # log('url map', app.url_map) app.register_blueprint(index_routes) app.register_blueprint(topic_routes, url_prefix='/topic') app.register_blueprint(reply_routes, url_prefix='/reply') app.register_blueprint(chat_routes, url_prefix='/chat') app.template_filter()(count) app.template_filter()(format_time) app.errorhandler(404)(not_found) admin = Admin(app, name='web19', template_mode='bootstrap3') mv = UserModelView(User, db.session) mv.column_searchable_list = ['username', 'password'] admin.add_view(mv) # admin.add_view(ModelView(User, db.session)) # admin.add_view(ModelView(Topic, db.session)) # admin.add_view(ModelView(Reply, db.session)) # Add administrative views here socketio.init_app(app) return app