2023-11-18 23:23:17 +00:00
|
|
|
from flask import Flask, request, redirect, url_for, render_template
|
2023-11-19 00:07:25 +00:00
|
|
|
from app.views import routes
|
2023-11-19 00:48:18 +00:00
|
|
|
from flask import jsonify
|
2023-11-18 23:23:17 +00:00
|
|
|
|
|
|
|
def create_app():
|
|
|
|
# create and configure the app
|
|
|
|
app = Flask(__name__)
|
|
|
|
app.config.from_pyfile('settings.py')
|
2023-11-19 00:07:25 +00:00
|
|
|
app.register_blueprint(routes)
|
|
|
|
return app
|
2023-11-19 00:48:18 +00:00
|
|
|
|
2023-11-19 00:48:57 +00:00
|
|
|
app = create_app()
|
2023-11-19 00:48:18 +00:00
|
|
|
|
|
|
|
@app.errorhandler(403)
|
|
|
|
def not_authorised(e):
|
|
|
|
return jsonify(error="Not authorized"), 403
|
|
|
|
|
|
|
|
@app.errorhandler(500)
|
|
|
|
def internal_server_error(e):
|
|
|
|
return jsonify(error="Internal server error"), 500
|
2023-11-19 00:48:57 +00:00
|
|
|
|