mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-06 03:13:42 -05:00
remove wsgi.py - always serve with whitenoise
We're now running our app as a wsgi app locally, so don't need to distinguish between the two processes by having wsgi and application.py whitenoise just serves static files nicely - we don't lose anything by doing that locally.
This commit is contained in:
@@ -4,7 +4,6 @@ from flask import (
|
||||
jsonify,
|
||||
request,
|
||||
url_for,
|
||||
current_app
|
||||
)
|
||||
from flask_login import login_required
|
||||
|
||||
@@ -21,27 +20,11 @@ from app.utils import (
|
||||
get_template,
|
||||
get_time_left,
|
||||
get_letter_timings,
|
||||
REQUESTED_STATUSES,
|
||||
FAILURE_STATUSES,
|
||||
SENDING_STATUSES,
|
||||
DELIVERED_STATUSES,
|
||||
)
|
||||
|
||||
|
||||
def get_status_arg(filter_args):
|
||||
if 'status' not in filter_args or not filter_args['status']:
|
||||
return REQUESTED_STATUSES
|
||||
elif filter_args['status'] == 'sending':
|
||||
return SENDING_STATUSES
|
||||
elif filter_args['status'] == 'delivered':
|
||||
return DELIVERED_STATUSES
|
||||
elif filter_args['status'] == 'failed':
|
||||
return FAILURE_STATUSES
|
||||
else:
|
||||
current_app.logger.info('Unrecognised status filter: {}'.format(filter_args['status']))
|
||||
return REQUESTED_STATUSES
|
||||
|
||||
|
||||
@main.route("/services/<service_id>/notification/<uuid:notification_id>")
|
||||
@login_required
|
||||
@user_has_permissions('view_activity', admin_override=True)
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
import os
|
||||
|
||||
from flask import Flask
|
||||
from whitenoise import WhiteNoise
|
||||
|
||||
from app import create_app
|
||||
|
||||
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
|
||||
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'app', 'static')
|
||||
STATIC_URL = 'static/'
|
||||
|
||||
app = Flask('app')
|
||||
|
||||
create_app(app)
|
||||
application = WhiteNoise(app, STATIC_ROOT, STATIC_URL)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
|
||||
buildpack: python_buildpack
|
||||
command: scripts/run_app_paas.sh gunicorn -c /home/vcap/app/gunicorn_config.py --error-logfile /home/vcap/logs/gunicorn_error.log -w 5 -b 0.0.0.0:$PORT wsgi
|
||||
command: scripts/run_app_paas.sh gunicorn -c /home/vcap/app/gunicorn_config.py --error-logfile /home/vcap/logs/gunicorn_error.log -w 5 -b 0.0.0.0:$PORT application
|
||||
services:
|
||||
- notify-aws
|
||||
- notify-config
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
|
||||
buildpack: python_buildpack
|
||||
command: scripts/run_app_paas.sh gunicorn -w 5 -b 0.0.0.0:$PORT wsgi
|
||||
command: scripts/run_app_paas.sh gunicorn -w 5 -b 0.0.0.0:$PORT application
|
||||
services:
|
||||
- notify-aws
|
||||
- notify-config
|
||||
|
||||
14
wsgi.py
14
wsgi.py
@@ -1,14 +0,0 @@
|
||||
import os
|
||||
|
||||
from flask import Flask
|
||||
from whitenoise import WhiteNoise
|
||||
|
||||
from app import create_app
|
||||
|
||||
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
|
||||
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'app', 'static')
|
||||
STATIC_URL = 'static/'
|
||||
|
||||
app = Flask('app')
|
||||
create_app(app)
|
||||
application = WhiteNoise(app, STATIC_ROOT, STATIC_URL)
|
||||
Reference in New Issue
Block a user