Exemple #1
0
def init_extensions(app):
    for extension in app.config['EXTENSIONS']:

        e = __import__(extension)
        blueprint = e.__dict__[e.__meta__['BlueprintName']]
        app.logger.info("Enabled Extension %s" % e.__meta__['Title'])
        app.register_blueprint(blueprint, url_prefix=e.__meta__['DefaultUrlPrefix'])
        EXTENSIONS[e.__meta__["BlueprintName"]] = e
        register(e)

        context_processors = e.__meta__.get('ContextProcessors', [])
        for context_processor in context_processors:
            try:
                module_name = ".".join(context_processor.split(".")[:-1])

                function = context_processor.split(".")[-1]
                mod = importlib.import_module(module_name)
                app.context_processor(getattr(mod, function))
            except:
                app.logger.exception("Error loading context processor %s" % context_processor)
Exemple #2
0
# -*- coding: utf-8 -*-
from upload import upload_page
from base import app

app.register_blueprint(upload_page, url_prefix="/upload")

Exemple #3
0
from base import app

import main
app.register_blueprint(main.mod, url_prefix="/LfunctionDB")
Exemple #4
0
# -*- coding: utf-8 -*-
from base import app
from utils import make_logger
from flask import Blueprint

local_fields_page = Blueprint("local_fields",
                              __name__,
                              template_folder='templates',
                              static_folder="static")
logger = make_logger(local_fields_page)


@local_fields_page.context_processor
def body_class():
    return {'body_class': 'local_fields'}


import main

app.register_blueprint(local_fields_page, url_prefix="/LocalField")
Exemple #5
0
app.config['SECRET_KEY'] = "123456"
app.config['DEBUG_TB_INTERCEPT_REDIRECTS'] = False
toolbar = DebugToolbarExtension(app)

import config
from models import db
from models.deploy import *

#Blueprint导入
from views.deploy import blue_print as deploy_bp

admin = admin.Admin(app, name=u'Deploy Admin')
admin.add_view(sqla.ModelView(Host, db.session, name=u"主机"))

#注册bp
app.register_blueprint(deploy_bp, url_prefix="")



@app.route('/')
def index():
    return redirect("/deploy")

@app.before_request
def before_request():
    print "-- in blue_print app"

@app.errorhandler(Exception)
def exception_handler(e):
    exc_type, exc_value, exc_traceback = sys.exc_info()
    info = traceback.format_exception(exc_type, exc_value, exc_traceback)
from base import app
from controllers import *

app.register_blueprint(data_controller)
app.register_blueprint(index_controller)

Exemple #7
0
# -*- coding: utf-8 -*-
from base import app
from utils import make_logger
from flask import Blueprint

artin_representations_page = Blueprint("artin_representations",
                                       __name__,
                                       template_folder='templates',
                                       static_folder="static")
logger = make_logger(artin_representations_page)


@artin_representations_page.context_processor
def body_class():
    return {'body_class': 'artin_representations'}


import main

app.register_blueprint(artin_representations_page,
                       url_prefix="/ArtinRepresentation")
Exemple #8
0
# -*- coding: utf-8 -*-
from base import app
from utils import make_logger
from flask import Blueprint

OEIS_object_page = Blueprint("OEIS_object", __name__, template_folder='templates', static_folder="static")
logger = make_logger(OEIS_object_page)

@OEIS_object_page.context_processor
def body_class():
  return { 'body_class' : 'OEIS_object' }

import main 

# This is one possibility to inject pages into the Flask framework.
# For another, see the L-function page
app.register_blueprint(OEIS_object_page, url_prefix="/OEIS/")
Exemple #9
0
# -*- coding: utf-8 -*-
from base import app
from utils import make_logger
from flask import Blueprint

knowledge_page = Blueprint("knowledge", __name__, template_folder='templates')
logger = make_logger(knowledge_page)

import main 

app.register_blueprint(knowledge_page, url_prefix="/knowledge")

Exemple #10
0
# -*- coding: utf-8 -*-
from base import app
from utils import make_logger
from flask import Blueprint

local_fields_page = Blueprint("local_fields", __name__, template_folder='templates', static_folder="static")
logger = make_logger(local_fields_page)

@local_fields_page.context_processor
def body_class():
  return { 'body_class' : 'local_fields' }

import main 

app.register_blueprint(local_fields_page, url_prefix="/LocalField")


Exemple #11
0
# -*- coding: utf-8 -*-
from base import app
from utils import make_logger
from flask import Blueprint

knowledge_page = Blueprint("knowledge", __name__, template_folder='templates')
logger = make_logger(knowledge_page)

import main

app.register_blueprint(knowledge_page, url_prefix="/knowledge")
Exemple #12
0
# -*- coding: utf-8 -*-

from main import login_page, login_manager, admin_required

from base import app

# secret key, necessary for sessions, and sessions are
# in turn necessary for users to login
app.secret_key = '9af"]ßÄ!_°$2ha€42~µ…010'

login_manager.setup_app(app)

app.register_blueprint(login_page, url_prefix="/users")