diff --git a/ckan/ckan/tasks/ckan.yml b/ckan/ckan/tasks/ckan.yml index c42bd6c..3f0e644 100644 --- a/ckan/ckan/tasks/ckan.yml +++ b/ckan/ckan/tasks/ckan.yml @@ -14,6 +14,11 @@ notify: Restart CKAN tags: [ 'ckan', 'ckan_ini' ] +- name: Install the apache.wsgi + template: src=apache.wsgi.j2 dest={{ ckan_confdir }}/apache.wsgi + notify: Restart CKAN + tags: [ 'ckan', 'apache' ] + - name: Create the base directory for the CKAN file storage file: dest={{ ckan_file_storage_dir }} state=directory owner={{ apache_user }} group={{ ckan_shell_user }} mode=2770 tags: ckan diff --git a/ckan/ckan/templates/apache.wsgi.j2 b/ckan/ckan/templates/apache.wsgi.j2 new file mode 100644 index 0000000..4418d33 --- /dev/null +++ b/ckan/ckan/templates/apache.wsgi.j2 @@ -0,0 +1,14 @@ +import os +activate_this = os.path.join('/usr/lib/ckan/default/bin/activate_this.py') +execfile(activate_this, dict(__file__=activate_this)) + +from paste.deploy import loadapp + +config_filepath = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'production.ini') +from paste.script.util.logging_config import fileConfig +fileConfig(config_filepath) +_application = loadapp('config:%s' % config_filepath) + +def application(environ, start_response): + environ['wsgi.url_scheme'] = environ.get('HTTP_X_URL_SCHEME', 'http') + return _application(environ, start_response)