Ejemplo n.º 1
0
def create_app():
    app = Flask('stat_tracker')
    app.config.from_object(__name__)
    app.register_blueprint(users)
    app.register_blueprint(items)
    app.register_blueprint(api, url_prefix="/api/v1")

    config.init_app(app)
    db.init_app(app)
    debug_toolbar.init_app(app)
    migrate.init_app(app, db)
    bcrypt.init_app(app)
    CsrfProtect(app)
    login_manager.init_app(app)
    login_manager.login_view = "users.login"

    return app
Ejemplo n.º 2
0
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.wtf import CsrfProtect
from flask.ext.login import LoginManager


app = Flask(__name__)
app.config.from_object('config')
db = SQLAlchemy(app)
csrf = CsrfProtect(app)
lm = LoginManager()
lm.init_app(app)
from server import views, models


Ejemplo n.º 3
0
from flask.ext.bootstrap import Bootstrap
from flask.ext.wtf import Form, CsrfProtect
from acitoolkit.acitoolkitlib import Credentials
from acitoolkit.acisession import Session, CredentialsError
from requests import Timeout, ConnectionError
# Create application
from Forms import FeedbackForm, CredentialsForm, ResetForm
from aciConSearch import FlowSpec, SearchDb, ProtocolFilter

# start the flask application and tell it the static folder is called 'static'
app = Flask(__name__, static_folder='static')

# todo: need to validate the secrete key
app.config['SECRET_KEY'] = 'Dnit7qz7mfcP0YuelDrF8vLFvk0snhwP'
app.config['CSRF_ENABLED'] = True
CsrfProtect(app)

bootstrap = Bootstrap(app)

# Create the ACI Search Database
sdb = SearchDb()


class APICArgs(object):
    """
    Class to hold the Arguments of the APIC
    """
    def __init__(self, ipaddr, username, secure, password):
        self.login = username
        self.password = password
        if ipaddr is not None:
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager
from flask.ext.assets import Environment
from flask.ext.wtf import CsrfProtect
from flask.ext.compress import Compress
from flask.ext.rq import RQ

from config import config
from assets import (app_css, app_js, vendor_css, vendor_js, asylum_css,
                    asylum_js, asylum_scss)

basedir = os.path.abspath(os.path.dirname(__file__))

mail = Mail()
db = SQLAlchemy()
csrf = CsrfProtect()
compress = Compress()
# Set up Flask-Login
login_manager = LoginManager()
# TODO: Ideally this should be strong, but that led to bugs. Once this is
# fixed, switch protection mode back to 'strong'
login_manager.session_protection = 'basic'
login_manager.login_view = 'account.login'


def create_app(config_name):
    app = Flask(__name__)
    app.config.from_object(config[config_name])
    config[config_name].init_app(app)

    # Set up extensions
Ejemplo n.º 5
0
from flask import Flask
from flask.ext.wtf import CsrfProtect

application = Flask(__name__)
application.config.from_envvar('CATHERDER_CONFIG')
CsrfProtect(application)
import models
import routes

from application import auth