diff options
author | Adrian Turjak <adriant@catalyst.net.nz> | 2018-04-17 18:27:27 +1200 |
---|---|---|
committer | Adrian Turjak <adriant@catalyst.net.nz> | 2018-05-15 01:41:01 +0000 |
commit | 0ca736e5da47413db6749053e6083b82cbb24825 (patch) | |
tree | f20dbf95b8ba1c6998e43449f7cb3c5fc3c44ef7 /openstack_dashboard/management | |
parent | 0080405eb56fc1a27775188ab09457ae8c993add (diff) | |
download | horizon-0ca736e5da47413db6749053e6083b82cbb24825.tar.gz |
Create new wsgi.py file and deprecate old file
Django 1.4 stopped creating django.wsgi files and the common
practice now for a while has been a wsgi.py since it is actually
python code, and should actually be importable.
Right now someone has to copy and rename the existing file if they
want to use it with a server like gunicorn.
This patch adds a new file in location that is importable via python
and adds a deprecation log to the old one.
This also updates the wsgi generation commands to instead create
'horizon_wsgi.py' and have the apache conf generation also use that
or the default wsgi file.
Change-Id: I0f8bd16c8973ad23bcd8f73b54584dc69e5aed0c
Closes-Bug: #1763204
Diffstat (limited to 'openstack_dashboard/management')
-rw-r--r-- | openstack_dashboard/management/commands/make_web_conf.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/openstack_dashboard/management/commands/make_web_conf.py b/openstack_dashboard/management/commands/make_web_conf.py index f663ccfa4..080e88f59 100644 --- a/openstack_dashboard/management/commands/make_web_conf.py +++ b/openstack_dashboard/management/commands/make_web_conf.py @@ -85,8 +85,10 @@ context['PROJECT_DIR_NAME'] = os.path.basename( context['PROJECT_PATH'].split(context['PROJECT_ROOT'])[1]) context['PROJECT_NAME'] = context['PROJECT_DIR_NAME'] +context['DEFAULT_WSGI_FILE'] = os.path.join( + context['PROJECT_PATH'], 'wsgi.py') context['WSGI_FILE'] = os.path.join( - context['PROJECT_PATH'], 'wsgi/horizon.wsgi') + context['PROJECT_PATH'], 'horizon_wsgi.py') VHOSTNAME = context['HOSTNAME'].split('.') VHOSTNAME[0] = context['PROJECT_NAME'] @@ -316,6 +318,10 @@ location you desire, e.g.:: # Generate the apache configuration. elif options.get('apache'): + # first check if custom wsgi file exists, if not, use default: + if not os.path.exists(context['WSGI_FILE']): + context['WSGI_FILE'] = context['DEFAULT_WSGI_FILE'] + with open( os.path.join(CURDIR, 'apache_vhost.conf.template'), 'r' ) as fp: |