2024-01-01 15:39:48 +00:00
|
|
|
from flask import Flask
|
2023-12-31 16:59:53 +00:00
|
|
|
from os import environ
|
2024-01-01 20:19:57 +00:00
|
|
|
from controllers.web import blueprint
|
2024-01-01 15:39:48 +00:00
|
|
|
|
2023-12-27 21:36:53 +00:00
|
|
|
'''
|
|
|
|
Main entrypoint for Flask application.
|
|
|
|
Initialises any components that are needed at runtime such as the
|
|
|
|
Database manager...
|
|
|
|
'''
|
|
|
|
def main():
|
|
|
|
app = Flask(__name__)
|
2023-11-16 10:29:26 +00:00
|
|
|
|
2023-12-31 16:59:53 +00:00
|
|
|
# Set app secret key to sign session cookies
|
|
|
|
secret_key = environ.get("APPSECRET")
|
|
|
|
if secret_key == None:
|
|
|
|
# NO Secret Key set!
|
|
|
|
print("No app secret set, please set one before deploying in production")
|
2024-01-01 17:52:44 +00:00
|
|
|
app.secret_key = "DEFAULTKEY"
|
2023-12-31 16:59:53 +00:00
|
|
|
else:
|
|
|
|
app.secret_key = secret_key
|
|
|
|
|
2023-12-27 21:36:53 +00:00
|
|
|
# Register a blueprint
|
|
|
|
app.register_blueprint(blueprint)
|
2024-01-01 15:39:48 +00:00
|
|
|
app.run(debug=True, host="0.0.0.0")
|
2023-12-27 21:36:53 +00:00
|
|
|
|
2023-11-16 10:29:26 +00:00
|
|
|
if __name__ == "__main__":
|
2023-12-27 21:36:53 +00:00
|
|
|
main()
|