32 lines
612 B
Python
32 lines
612 B
Python
|
#!/usr/bin/env python3
|
||
|
import os
|
||
|
from flask import Flask
|
||
|
from werkzeug.middleware.proxy_fix import ProxyFix
|
||
|
|
||
|
# import stuff
|
||
|
from utils import register_all_error_handlers
|
||
|
|
||
|
# import views
|
||
|
from views import ObjectView
|
||
|
|
||
|
# create flask app
|
||
|
app = Flask(__name__)
|
||
|
app.wsgi_app = ProxyFix(app.wsgi_app, x_proto=1)
|
||
|
|
||
|
# important stuff
|
||
|
app.secret_key = os.environ.get('SECRET_KEY', os.urandom(12))
|
||
|
|
||
|
# register error handlers
|
||
|
register_all_error_handlers(app)
|
||
|
|
||
|
# register views
|
||
|
for view in [ObjectView]:
|
||
|
view.register(app, trailing_slash=False)
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
# start debuggig if needed
|
||
|
if __name__ == "__main__":
|
||
|
app.run(debug=True)
|