Remove blueprint.

This commit is contained in:
Alexis Lahouze 2016-06-16 23:03:45 +02:00
parent 000fa7fcd2
commit 0ea35808f3
14 changed files with 18 additions and 6 deletions

View File

@ -16,25 +16,37 @@
"""
from flask import Flask, redirect, url_for
from flask.ext.sqlalchemy import SQLAlchemy
from flask_restplus import Api
from flask_cors import CORS
from flask_sqlalchemy import SQLAlchemy
# The app
app = Flask(__name__, static_folder=None)
app = Flask(__name__, static_folder=None, template_folder=None)
app.config.from_pyfile('config.cfg')
app.config['SQLALCHEMY_ECHO'] = app.debug
app.config['SQLALCHEMY_COMMIT_ON_TEARDOWN'] = True
# Database initialization.
db = SQLAlchemy(app)
# Must be after db declaration because some components in blueprints need it.
from .api import blueprint as api
# API initialization.
authorizations = {
'apikey': {
'type': 'apiKey',
'in': 'header',
'name': 'Authorization'
}
}
app.register_blueprint(api, url_prefix='/api')
api = Api(app, doc='/doc/', authorizations=authorizations)
CORS(app)
# Load all views.
from .views import * # flake8: noqa
# Redirect / to API documentation.
@app.route('/')
def index():
return redirect(url_for('api.doc'))
return redirect(url_for('doc'))