mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-09 14:42:24 -05:00
ensure app can run on paas
instead of using wsgi, we now use "application" - this tells gunicorn to look inside the python module application (application.py) for a wsgi app - and by default that is also called application so rename the variable. Also, when running tasks, we're not using gunicorn so need to set the flask variable in the manifest so that `flask command ...` finds the app properly. Remove server_commands as it's not used any more.
This commit is contained in:
@@ -5,6 +5,6 @@ from flask import Flask
|
||||
|
||||
from app import create_app
|
||||
|
||||
app = Flask('app')
|
||||
application = Flask('app')
|
||||
|
||||
create_app(app)
|
||||
create_app(application)
|
||||
|
||||
@@ -14,6 +14,8 @@ services:
|
||||
env:
|
||||
NOTIFY_APP_NAME: public-api
|
||||
CW_APP_NAME: api
|
||||
# required by cf run-task
|
||||
FLASK_APP: application.py
|
||||
instances: 1
|
||||
memory: 1G
|
||||
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
from flask_migrate import Migrate, MigrateCommand
|
||||
from app import (create_app, db, commands)
|
||||
import os
|
||||
|
||||
default_env_file = '/home/ubuntu/environment'
|
||||
environment = 'live'
|
||||
|
||||
if os.path.isfile(default_env_file):
|
||||
with open(default_env_file, 'r') as environment_file:
|
||||
environment = environment_file.readline().strip()
|
||||
|
||||
from app.config import configs
|
||||
|
||||
os.environ['NOTIFY_API_ENVIRONMENT'] = configs[environment]
|
||||
|
||||
application = create_app()
|
||||
|
||||
migrate = Migrate(application, db)
|
||||
application.add_command('db', MigrateCommand)
|
||||
application.add_command('purge_functional_test_data', commands.PurgeFunctionalTestDataCommand)
|
||||
application.add_command('custom_db_script', commands.CustomDbScript)
|
||||
|
||||
if __name__ == '__main__':
|
||||
manager.run()
|
||||
Reference in New Issue
Block a user