[ckan-dev] Flask URL generation error

Prashant Gupta p.gupta at auckland.ac.nz
Tue Aug 7 23:26:59 UTC 2018


Hi,

I am running an instance of CKAN 2.8.1 on Ubuntu 16.04. I am trying to install ckanext-shibboleth (https://github.com/geosolutions-it/ckanext-shibboleth) but getting the following error:

[Wed Aug 08 10:38:42.924435 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483] mod_wsgi (pid=13849): Target WSGI script '/etc/ckan/default/apache.wsgi' cannot be loaded as Python module.
[Wed Aug 08 10:38:42.924496 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483] mod_wsgi (pid=13849): Exception occurred processing WSGI script '/etc/ckan/default/apache.wsgi'.
[Wed Aug 08 10:38:42.924523 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483] Traceback (most recent call last):
[Wed Aug 08 10:38:42.924589 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]   File "/etc/ckan/default/apache.wsgi", line 10, in <module>
[Wed Aug 08 10:38:42.924628 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]     application = loadapp('config:%s' % config_filepath)
[Wed Aug 08 10:38:42.924647 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]   File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
[Wed Aug 08 10:38:42.924837 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]     return loadobj(APP, uri, name=name, **kw)
[Wed Aug 08 10:38:42.924861 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]   File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
[Wed Aug 08 10:38:42.924891 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]     return context.create()
[Wed Aug 08 10:38:42.924909 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]   File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 710, in create
[Wed Aug 08 10:38:42.924927 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]     return self.object_type.invoke(self)
[Wed Aug 08 10:38:42.924947 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]   File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 146, in invoke
[Wed Aug 08 10:38:42.924965 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]     return fix_call(context.object, context.global_conf, **context.local_conf)
[Wed Aug 08 10:38:42.924976 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]   File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/util.py", line 55, in fix_call
[Wed Aug 08 10:38:42.925000 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]     val = callable(*args, **kw)
[Wed Aug 08 10:38:42.925084 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]   File "/usr/lib/ckan/default/src/ckan/ckan/config/middleware/__init__.py", line 58, in make_app
[Wed Aug 08 10:38:42.925172 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]     **app_conf)
[Wed Aug 08 10:38:42.925191 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]   File "/usr/lib/ckan/default/src/ckan/ckan/config/middleware/pylons_app.py", line 121, in make_pylons_stack
[Wed Aug 08 10:38:42.925305 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]     who_parser.parse(open(app_conf['who.config_file']))
[Wed Aug 08 10:38:42.925325 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]   File "/usr/lib/ckan/default/lib/python2.7/site-packages/repoze/who/config.py", line 86, in parse
[Wed Aug 08 10:38:42.925357 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]     obj = self._makePlugin(name, IPlugin, options)
[Wed Aug 08 10:38:42.925375 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]   File "/usr/lib/ckan/default/lib/python2.7/site-packages/repoze/who/config.py", line 42, in _makePlugin
[Wed Aug 08 10:38:42.925393 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]     obj = obj(**options)
[Wed Aug 08 10:38:42.925414 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]   File "/usr/lib/ckan/default/src/ckanext-shibboleth/ckanext/shibboleth/repoze/ident.py", line 33, in make_identification_plugin
[Wed Aug 08 10:38:42.925438 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]     return ShibbolethIdentifierPlugin(**kwargs)
[Wed Aug 08 10:38:42.925455 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]   File "/usr/lib/ckan/default/src/ckanext-shibboleth/ckanext/shibboleth/repoze/ident.py", line 76, in __init__
[Wed Aug 08 10:38:42.925477 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]     self.login_url = h.url_for(controller=controller, action='shiblogin')
[Wed Aug 08 10:38:42.925502 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]   File "/usr/lib/ckan/default/src/ckan/ckan/lib/helpers.py", line 318, in url_for
[Wed Aug 08 10:38:42.925525 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]     my_url = _url_for_flask(*args, **kw)
[Wed Aug 08 10:38:42.925550 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]   File "/usr/lib/ckan/default/src/ckan/ckan/lib/helpers.py", line 377, in _url_for_flask
[Wed Aug 08 10:38:42.925568 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]     my_url = _flask_default_url_for(*args, **kw)
[Wed Aug 08 10:38:42.925584 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]   File "/usr/lib/ckan/default/lib/python2.7/site-packages/flask/helpers.py", line 270, in url_for
[Wed Aug 08 10:38:42.925606 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483]     raise RuntimeError('Attempted to generate a URL without the '
[Wed Aug 08 10:38:42.925645 2018] [wsgi:error] [pid 13849:tid 139993845167872] [remote 130.216.158.32:483] RuntimeError: Attempted to generate a URL without the application context being pushed. This has to be executed when application context is available.

With a bit of research, I found that this is due to the changes to support url_for for both Flask and Pylons. However, the solution given at https://github.com/ckan/ckan/issues/3083 only tells what we need to do in tests. In my case, this is resulting from a url_for call in ‘ident.py’.

I would really appreciate any help.

Cheers,
Prashant
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20180807/a58ac568/attachment-0001.html>


More information about the ckan-dev mailing list