コード例 #1
0
import app
from route import *

app = app.create_app()

app.login_manager.user_loader(load_user)
app.login_manager.unauthorized_handler(unauthorized)

app.add_url_rule(index.route_index,
                 view_func=index.func,
                 methods=index.methods)
for rule in maps:
    app.add_url_rule(rule.route_index,
                     view_func=login_required(rule.func),
                     methods=rule.methods)

if __name__ == '__main__':
    app.run(debug=True, port=5001, host="127.0.0.1")
コード例 #2
0
import logging
import sys
import app

IS_DEV = False
if __name__ == '__main__':
    IS_DEV = True

app.init(debug=IS_DEV)

from app.functions.emotion import emotion

if IS_DEV:
    from flask import Flask, request
    app = Flask(__name__)

    functions = [
        'emotion',
    ]
    # app.add_url_rule(f'/test_message', 'test_message', test_message, methods=['POST', 'GET'], defaults={'request': request})
    for function in functions:
        app.add_url_rule(f'/{function}',
                         function,
                         locals()[function],
                         methods=['POST', 'GET'],
                         defaults={'request': request})

    app.run(host='127.0.0.1', port=8088, debug=True)
コード例 #3
0
ファイル: web.py プロジェクト: nubela/nubela-utils
from {{MODULE_NAME}}.app import app

def index():
    return "works"

app.add_url_rule('/',
                 "index", index, methods=['GET'])