示例#1
0
def init():

    for p, f, file_list in os.walk(os.path.abspath(os.path.join(os.path.dirname(__file__), os.curdir))):
        for  _file in file_list:
            arr = _file.split(".")
            file_name = arr[0]
            file_type = arr[1]
            if file_type == "py" and file_name != "__init__":
                module = importlib.import_module("."+file_name,package=__name__)
                app.register_blueprint(module.bp)
示例#2
0
import sys
import os
from os.path import dirname, join
sys.path.insert(0, dirname(__file__))
activate_this = join(dirname(__file__), '.env', 'bin', 'activate_this.py')
execfile(activate_this, dict(__file__=activate_this))

from web import app as application
from web.apps.frontend import frontend
application.register_blueprint(frontend)
application.debug = True

if __name__ == '__main__':
    application.run('0.0.0.0')

示例#3
0
from web import app
from .AttackAnalysis.AttackAnalysis import AttackAnalysis
from .AttackDetection.AttackDetection import AttackDetection
from .HomePage.Homepage import Homepage
from .HomePage.Home import Home
from .SituationAssessment.SituationAssessment import SituationAssessment

app.register_blueprint(AttackAnalysis, url_prefix='/AttackAnalysis')
app.register_blueprint(AttackDetection, url_prefix='/AttackDetection')
app.register_blueprint(Home, url_prefix='/Home')
app.register_blueprint(Homepage, url_prefix='/Homepage')
app.register_blueprint(SituationAssessment, url_prefix='/SituationAssessment')
示例#4
0
from web.controllers.main import main as main_blueprint
from web import app, db
from flask import render_template, abort

app.register_blueprint(main_blueprint)


@app.errorhandler(404)
def not_found_error(error):
    print("yee haw")
    return render_template('404.html'), 404


@app.errorhandler(500)
def internal_error(error):
    db.session.rollback()
    return render_template('500.html'), 500
from web import app
from admin.routes import admin_bp

app.register_blueprint(admin_bp)
示例#6
0
import sys

from web import app

from flask import Flask
from flask import render_template
from flask import jsonify

import setting

from web.controller.home import *
from web.controller.hold_stock import hold_stock_blueprint
from web.controller.index_pe import index_pe_blueprint
from web.controller.index import index_blueprint
from web.controller.money_flow_north_south import money_flow_blueprint
from web.controller.margin import margin_blueprint

app.register_blueprint(hold_stock_blueprint)
app.register_blueprint(index_pe_blueprint)
app.register_blueprint(index_blueprint)
app.register_blueprint(money_flow_blueprint)
app.register_blueprint(margin_blueprint)
示例#7
0
def register_blueprints():
    ''' Register application blueprint. '''
    app.register_blueprint(home)
    app.register_blueprint(api, url_prefix='/api')
    app.register_blueprint(sse, url_prefix='/stream')
示例#8
0
def register():
    header = {'Content-type': 'application/json'}

    if request.method == "POST":
        print(request.form['username'])
        register_user = requests.post(app.config['MOVIE_API_URL'] + 'v1/user/register', headers=header,
                                      json={"username": request.form['username'], "password": request.form['password'],
                                            "email": request.form['email'], 'name': request.form['name']})
        print(register_user.status_code)
        if register_user.status_code == 201:
            print(register_user.json())
            flash(register_user.json()['message'])
            return redirect(url_for('register'))
        else:
            print(register_user.json())

    return render_template('register.html')


@app.route('/logout')
def logout():
    logout_user_access = requests.post(app.config['MOVIE_API_URL'] + 'v1/user/logout/access')
    logout_user_refresh = requests.post(app.config['MOVIE_API_URL'] + 'v1/user/logout/refresh')
    session.pop('username', None)
    session.pop('access_token', None)
    session.pop('refresh_token', None)
    return redirect(url_for('index'))


app.register_blueprint(pwa.blueprint)
示例#9
0
    To interact with the GeoServer REST API, the GeoServer configuration client library by boundlessgeo is used, see:
    https://github.com/boundlessgeo/gsconfig

     On the client side it uses jquery.js, leaflet.js, nprogress.js, DataTables and the UIKit framework,
     for further information see the README.md file.

    :copyright: (c) 2015 by Martin Hochenwarter
    :license:  MIT
"""

__author__ = 'Martin Hochenwarter'
__version__ = '0.1'


import os
from web import app

from web.basic import basic
from web.devmap import devmap
from web.jsonapi import jsonapi
from web.geojsonapi import geojsonapi

#: Import used blueprints
app.register_blueprint(basic)
app.register_blueprint(devmap)
app.register_blueprint(jsonapi)
app.register_blueprint(geojsonapi)

if __name__ == '__main__':
    port = int(os.environ.get('PORT', 5000))
    app.run(host='0.0.0.0', port=port)