""" wsgi ~~~~ web wsgi module """ # auto Alembic import sys from os.path import dirname, abspath sys.path.append(dirname(dirname(abspath(__file__)))) from subprocess import Popen, PIPE, STDOUT from werkzeug.serving import run_simple from werkzeug.wsgi import DispatcherMiddleware from app import api, frontend, restless application = DispatcherMiddleware(frontend.create_app(), { '/api': api.create_app(), '/restless': restless.create_app() }) if __name__ == "__main__": # Preform Database Upgrades Automatically :) command = 'alembic upgrade head' Popen(command, shell=True) run_simple('0.0.0.0', 9400, application, use_reloader=True, use_debugger=True)
#!/usr/bin/env python import os import readline from pprint import pprint from flask import * import app from app.frontend import create_app application = create_app() os.environ['PYTHONINSPECT'] = 'True'
#!/usr/bin/env python # -*- coding: utf-8 -*- from werkzeug.serving import run_simple from werkzeug.wsgi import DispatcherMiddleware from app.frontend import create_app frontend = create_app(settings_override="app.config.Development") application = DispatcherMiddleware(frontend, {}) if __name__ == "__main__": with frontend.app_context(): # db.create_all() pass run_simple('0.0.0.0', 5000, application, use_reloader=True, use_debugger=True)
def _create_app(self): return create_app(settings)
from werkzeug.wsgi import DispatcherMiddleware sys.path.insert(0, '/home/flask/Luyasi-Flask') from app import frontend from app import api from dxc import setting reload(sys) sys.setdefaultencoding('utf-8') # from flask.ext.security import forms # web应用 frontend_app = frontend.create_app(settings_override=setting) # api接口 api_app = api.create_app(settings_override=setting) # 可以分发给不同的app # application = DispatcherMiddleware(frontend) # application = DispatcherMiddleware(api_app) application = DispatcherMiddleware(frontend_app, {'/api': api_app}) if __name__ == "__main__": ip = api_app.config['KINORSI_SERVER_NAME'] port = api_app.config['KINORSI_SERVER_PORT'] # run_simple('127.0.0.1', 5000, application, use_reloader=True, use_debugger=True) #If you’re using Aptana/Eclipse for debugging you’ll need to set both use_debugger and use_reloader to False.
# -*- coding: utf-8 -*- """ runserver ~~~~ riskmanager wsgi module """ from werkzeug.serving import run_simple from werkzeug.wsgi import DispatcherMiddleware from app import api, frontend application = DispatcherMiddleware(frontend.create_app(), {'/api/v1': api.create_app()}) if __name__ == "__main__": run_simple('0.0.0.0', 5000, application, use_reloader=True, use_debugger=True)