Пример #1
0
# from flask import Flask,current_app

# app=Flask(__name__)

# if __name__== '__main__':
#     with app.app_context():
#         import a
#         import b
#         app.run(host='0.0.0.0',debug='True')

from flask import Flask, current_app
from flask_uwsgi_websocket import WebSocket
from flask_uwsgi_websocket import GeventWebSocket
from create import create_app

app = create_app()
# # iniit app
# app = Flask(__name__)

# try:
#     sockets = GeventWebSocket(app=app)
# except Exception as e:
#     print("Error: flask_uwsgi_websocket, {0}".format(e))

# app.config['SECRET_KEY']="akjskldjf"
# with app.app_context():

#     # 藍圖註冊
#     from api.index.Index import router_index
#     from api.wsocket.Wsocket import router_websocket
Пример #2
0
from __future__ import unicode_literals, print_function, division, absolute_import

import os

from create import create_app

app = create_app(os.getenv('APP_CONFIG') or 'default')

if __name__ == '__main__':
    app.run(host='0.0.0.0')
Пример #3
0
#  application/run.py
# 만들어진 서버 객체를 실행한다.
from create import create_app
import argparse

parser = argparse.ArgumentParser(description='서버 실행 환경 선택')
parser.add_argument('--env', required=False, default='dev', help='dev, prod, test 가 있습니다.')

args = parser.parse_args()
app = create_app(args.env)

if __name__ == '__main__':
    app.run()
Пример #4
0
from __future__ import unicode_literals, print_function, division, absolute_import
import os

from flask_script import Manager, Shell
from flask_migrate import MigrateCommand
import pytest

from create import create_app
from models import db, User

application = create_app(os.getenv('APP_CONFIG') or 'default')


def make_shell_context():
    return dict(app=application, db=db, User=User)


manager = Manager(application)
manager.add_command('db', MigrateCommand)
manager.add_command('shell', Shell(make_context=make_shell_context))


@manager.command
def createdb():
    db.create_all()


@manager.command
def resetdb():
    db.drop_all()
    db.create_all()
Пример #5
0
 def create_app(self):
     return create_app('testing')
Пример #6
0
from config import ProductionConfig, TestConfig
from create import create_app
import os

app = create_app(TestConfig)

if __name__ == "__main__":
    app.run(debug=True)