okfn/ckan — pull request #1111 by tobes (2013-07-16 09:20:41+00:00)
Title: 500 Error Upon Production Deployment

Hi everyone,

I was able to get CKAN working just fine locally, but trying to deploy per the instructions (http://docs.ckan.org/en/latest/deployment.html) gives me a 500 error. I checked permissions and everything is correct. Here's the log:

```
[Mon Jul 15 20:31:51 2013] [error] [client 198.211.103.157] mod_wsgi (pid=17063): Target WSGI script '/etc/ckan/default/apache.wsgi' cannot be loaded as Python module.
[Mon Jul 15 20:31:51 2013] [error] [client 198.211.103.157] mod_wsgi (pid=17063): Exception occurred processing WSGI script '/etc/ckan/default/apache.wsgi'.
[Mon Jul 15 20:31:51 2013] [error] [client 198.211.103.157] Traceback (most recent call last):
[Mon Jul 15 20:31:51 2013] [error] [client 198.211.103.157] File "/etc/ckan/default/apache.wsgi", line 9, in
[Mon Jul 15 20:31:51 2013] [error] [client 198.211.103.157] application = loadapp('config:%s' % config_filepath)
[Mon Jul 15 20:31:51 2013] [error] [client 198.211.103.157] File "/usr/lib/ckan/default/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
[Mon Jul 15 20:31:51 2013] [error] [client 198.211.103.157] return loadobj(APP, uri, name=name, **kw)
[Mon Jul 15 20:31:51 2013] [error] [client 198.211.103.157] File "/usr/lib/ckan/default/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
[Mon Jul 15 20:31:51 2013] [error] [client 198.211.103.157] return context.create()
[Mon Jul 15 20:31:51 2013] [error] [client 198.211.103.157] File "/usr/lib/ckan/default/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 710, in create
[Mon Jul 15 20:31:51 2013] [error] [client 198.211.103.157] return self.object_type.invoke(self)
[Mon Jul 15 20:31:51 2013] [error] [client 198.211.103.157] File "/usr/lib/ckan/default/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 146, in invoke
[Mon Jul 15 20:31:51 2013] [error] [client 198.211.103.157] return fix_call(context.object, context.global_conf, **context.local_conf)
[Mon Jul 15 20:31:51 2013] [error] [client 198.211.103.157] File "/usr/lib/ckan/default/lib/python2.6/site-packages/paste/deploy/util.py", line 56, in fix_call
[Mon Jul 15 20:31:51 2013] [error] [client 198.211.103.157] val = callable(*args, **kw)
[Mon Jul 15 20:31:51 2013] [error] [client 198.211.103.157] File "/usr/lib/ckan/default/src/ckan/ckan/config/middleware.py", line 54, in make_app
[Mon Jul 15 20:31:51 2013] [error] [client 198.211.103.157] load_environment(conf, app_conf)
[Mon Jul 15 20:31:51 2013] [error] [client 198.211.103.157] File "/usr/lib/ckan/default/src/ckan/ckan/config/environment.py", line 177, in load_environment
[Mon Jul 15 20:31:51 2013] [error] [client 198.211.103.157] config['routes.map'] = routing.make_map()
[Mon Jul 15 20:31:51 2013] [error] [client 198.211.103.157] File "/usr/lib/ckan/default/src/ckan/ckan/config/routing.py", line 100, in make_map
[Mon Jul 15 20:31:51 2013] [error] [client 198.211.103.157] map = plugin.before_map(map)
[Mon Jul 15 20:31:51 2013] [error] [client 198.211.103.157] File "/usr/lib/ckan/default/src/ckan/ckanext/datastore/plugin.py", line 248, in before_map
[Mon Jul 15 20:31:51 2013] [error] [client 198.211.103.157] print "Load mapping"
[Mon Jul 15 20:31:51 2013] [error] [client 198.211.103.157] IOError: sys.stdout access restricted by mod_wsgi
[Mon Jul 15 20:31:55 2013] [error] [client 198.211.103.157] mod_wsgi (pid=17064): Target WSGI script '/etc/ckan/default/apache.wsgi' cannot be loaded as Python module.
[Mon Jul 15 20:31:55 2013] [error] [client 198.211.103.157] mod_wsgi (pid=17064): Exception occurred processing WSGI script '/etc/ckan/default/apache.wsgi'.
[Mon Jul 15 20:31:55 2013] [error] [client 198.211.103.157] Traceback (most recent call last):
[Mon Jul 15 20:31:55 2013] [error] [client 198.211.103.157] File "/etc/ckan/default/apache.wsgi", line 9, in
[Mon Jul 15 20:31:55 2013] [error] [client 198.211.103.157] application = loadapp('config:%s' % config_filepath)
[Mon Jul 15 20:31:55 2013] [error] [client 198.211.103.157] File "/usr/lib/ckan/default/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
[Mon Jul 15 20:31:55 2013] [error] [client 198.211.103.157] return loadobj(APP, uri, name=name, **kw)
[Mon Jul 15 20:31:55 2013] [error] [client 198.211.103.157] File "/usr/lib/ckan/default/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
[Mon Jul 15 20:31:55 2013] [error] [client 198.211.103.157] return context.create()
[Mon Jul 15 20:31:55 2013] [error] [client 198.211.103.157] File "/usr/lib/ckan/default/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 710, in create
[Mon Jul 15 20:31:55 2013] [error] [client 198.211.103.157] return self.object_type.invoke(self)
[Mon Jul 15 20:31:55 2013] [error] [client 198.211.103.157] File "/usr/lib/ckan/default/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 146, in invoke
[Mon Jul 15 20:31:55 2013] [error] [client 198.211.103.157] return fix_call(context.object, context.global_conf, **context.local_conf)
[Mon Jul 15 20:31:55 2013] [error] [client 198.211.103.157] File "/usr/lib/ckan/default/lib/python2.6/site-packages/paste/deploy/util.py", line 56, in fix_call
[Mon Jul 15 20:31:55 2013] [error] [client 198.211.103.157] val = callable(*args, **kw)
[Mon Jul 15 20:31:55 2013] [error] [client 198.211.103.157] File "/usr/lib/ckan/default/src/ckan/ckan/config/middleware.py", line 54, in make_app
[Mon Jul 15 20:31:55 2013] [error] [client 198.211.103.157] load_environment(conf, app_conf)
[Mon Jul 15 20:31:55 2013] [error] [client 198.211.103.157] File "/usr/lib/ckan/default/src/ckan/ckan/config/environment.py", line 177, in load_environment
[Mon Jul 15 20:31:55 2013] [error] [client 198.211.103.157] config['routes.map'] = routing.make_map()
[Mon Jul 15 20:31:55 2013] [error] [client 198.211.103.157] File "/usr/lib/ckan/default/src/ckan/ckan/config/routing.py", line 100, in make_map
[Mon Jul 15 20:31:55 2013] [error] [client 198.211.103.157] map = plugin.before_map(map)
[Mon Jul 15 20:31:55 2013] [error] [client 198.211.103.157] File "/usr/lib/ckan/default/src/ckan/ckanext/datastore/plugin.py", line 248, in before_map
[Mon Jul 15 20:31:55 2013] [error] [client 198.211.103.157] print "Load mapping"
[Mon Jul 15 20:31:55 2013] [error] [client 198.211.103.157] IOError: sys.stdout access restricted by mod_wsgi
[Mon Jul 15 20:36:53 2013] [error] Exception KeyError: KeyError(140103623919424,) in ignored
[Mon Jul 15 20:36:53 2013] [error] Exception KeyError: KeyError(140103623919424,) in ignored
[Mon Jul 15 20:36:54 2013] [error] Exception AttributeError: "'NoneType' object has no attribute 'clearing'" in '
[Mon Jul 15 20:36:54 2013] [error] > ignored
[Mon Jul 15 20:36:54 2013] [error] Exception AttributeError: "'NoneType' object has no attribute 'clearing'" in '
[Mon Jul 15 20:36:54 2013] [error] > ignored
[Mon Jul 15 20:36:59 2013] [error] Load mapping
[Mon Jul 15 20:37:02 2013] [error] 2013-07-15 20:37:02,827 INFO [ckan.lib.base] / render time 2.856 seconds
```