Remove blueprint.
This commit is contained in:
1 parent
000fa7fcd2
commit
0ea35808f3
14 files changed
+18
-6
No files matched your search
+18
-6
@@ -16,25 +16,37 @@
|
|||||||
"""
|
"""
|
||||||
from flask import Flask, redirect, url_for
|
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
|
# 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.from_pyfile('config.cfg')
|
||||||
|
|
||||||
app.config['SQLALCHEMY_ECHO'] = app.debug
|
app.config['SQLALCHEMY_ECHO'] = app.debug
|
||||||
app.config['SQLALCHEMY_COMMIT_ON_TEARDOWN'] = True
|
app.config['SQLALCHEMY_COMMIT_ON_TEARDOWN'] = True
|
||||||
|
|
||||||
|
# Database initialization.
|
||||||
db = SQLAlchemy(app)
|
db = SQLAlchemy(app)
|
||||||
|
|
||||||
# Must be after db declaration because some components in blueprints need it.
|
# API initialization.
|
||||||
from .api import blueprint as api
|
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.
|
# Redirect / to API documentation.
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def index():
|
def index():
|
||||||
return redirect(url_for('api.doc'))
|
return redirect(url_for('doc'))
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Reference in new issue
Block a user