This commit is contained in:
parent
ea76463739
commit
5f2f73c9df
20
src/app.py
20
src/app.py
@ -37,8 +37,6 @@ if SENTRY_DSN:
|
|||||||
)
|
)
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.config['JWT_BLACKLIST_ENABLED'] = True
|
|
||||||
app.config['JWT_BLACKLIST_TOKEN_CHECKS'] = ['access', 'refresh']
|
|
||||||
app.config['REDIS_URL'] = REDIS_URL
|
app.config['REDIS_URL'] = REDIS_URL
|
||||||
api = Api(app)
|
api = Api(app)
|
||||||
health = HealthCheck()
|
health = HealthCheck()
|
||||||
@ -46,10 +44,6 @@ ma.init_app(app)
|
|||||||
flaskred.init_app(app)
|
flaskred.init_app(app)
|
||||||
CORS(app, origins=ALLOWED_ORIGINS)
|
CORS(app, origins=ALLOWED_ORIGINS)
|
||||||
|
|
||||||
formatter = logging.Formatter(
|
|
||||||
fmt="%(asctime)s - %(levelname)s - %(module)s - %(message)s"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@app.before_first_request
|
@app.before_first_request
|
||||||
def before_first_request():
|
def before_first_request():
|
||||||
@ -58,13 +52,6 @@ def before_first_request():
|
|||||||
musicbrainzngs.https = True
|
musicbrainzngs.https = True
|
||||||
|
|
||||||
|
|
||||||
handler = logging.StreamHandler()
|
|
||||||
handler.setFormatter(formatter)
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
logger.setLevel(logging.DEBUG)
|
|
||||||
logger.addHandler(handler)
|
|
||||||
|
|
||||||
api.add_resource(LoginApi, '/api/auth/login')
|
api.add_resource(LoginApi, '/api/auth/login')
|
||||||
api.add_resource(MeApi, '/api/auth/me')
|
api.add_resource(MeApi, '/api/auth/me')
|
||||||
api.add_resource(ListsApi, '/api/lists')
|
api.add_resource(ListsApi, '/api/lists')
|
||||||
@ -75,10 +62,3 @@ health.add_check(redis_available)
|
|||||||
app.add_url_rule("/healthz", "healthcheck", view_func=lambda: health.run())
|
app.add_url_rule("/healthz", "healthcheck", view_func=lambda: health.run())
|
||||||
|
|
||||||
register_all_error_handlers(app)
|
register_all_error_handlers(app)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
app.run(
|
|
||||||
debug=bool(DEBUG),
|
|
||||||
host="0.0.0.0",
|
|
||||||
port=int(PORT),
|
|
||||||
)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user