Core App changes to make it AWS compatible
This commit is contained in:
+13
-1
@@ -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)
|
||||
Reference in New Issue
Block a user