progress on jwt
This commit is contained in:
+13
-8
@@ -8,38 +8,43 @@ from app.errors import register_error_handlers
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from flask_migrate import Migrate
|
||||
from app.extensions import db, migrate
|
||||
from flask_jwt_extended import (
|
||||
JWTManager,
|
||||
jwt_required,
|
||||
create_access_token,
|
||||
get_jwt_identity,
|
||||
)
|
||||
|
||||
|
||||
def create_app():
|
||||
""" Factory function to create a Flask app instance """
|
||||
"""Factory function to create a Flask app instance"""
|
||||
app = Flask(__name__)
|
||||
|
||||
# Load configuration
|
||||
app.config.from_object(Config)
|
||||
|
||||
CORS(app)
|
||||
|
||||
CORS(app)
|
||||
JWTManager(app)
|
||||
|
||||
# Swagger Doc
|
||||
SWAGGER_URL = app.config.get("SWAGGER_URL")
|
||||
API_URL = app.config.get("API_URL")
|
||||
|
||||
|
||||
# Register blueprints
|
||||
app.register_blueprint(api)
|
||||
|
||||
swagger_ui_blueprint = get_swaggerui_blueprint(SWAGGER_URL, API_URL)
|
||||
app.register_blueprint(swagger_ui_blueprint, url_prefix=SWAGGER_URL)
|
||||
|
||||
|
||||
# Error Handlers
|
||||
register_error_handlers(app)
|
||||
|
||||
|
||||
from . import models
|
||||
|
||||
# Database and Migrations
|
||||
db.init_app(app)
|
||||
|
||||
|
||||
|
||||
migrate.init_app(app, db)
|
||||
|
||||
|
||||
return app
|
||||
|
||||
Reference in New Issue
Block a user