Core App changes to make it AWS compatible

This commit is contained in:
Anup Raj Gopinathan
2025-06-25 10:15:06 +02:00
parent a1694d1b75
commit b5849c7fbd
5 changed files with 37 additions and 20 deletions
+13 -1
View File
@@ -5,6 +5,8 @@ import os
import logging
from logging.handlers import RotatingFileHandler
from flask import render_template
from flask_migrate import upgrade
import awsgi
app = create_app()
@@ -39,4 +41,14 @@ if not app.debug:
app.logger.info('Mold Cost Calculator startup')
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5004)
app.run(host='0.0.0.0', port=5004)
def lambda_handler(event, context):
return awsgi.response(app, event, context)
def lambda_handler_upgrade_db(event, context):
with app.app_context():
upgrade()
return {"statusCode": 200, "body": "Database upgraded successfully"}
handler = Mangum(app)