Description

The “Upload to DataStore” function in the dataset page does not work because of the 500 Server Error:

image

Also, the http://127.0.0.1:8800 cannot be opened because of the 500 Server Error.

Check the error log /var/log/apache2/datapusher.error.log:

[Mon Aug 19 13:35:05.648265 2019] [wsgi:error] [pid 3574:tid 139753588152064] [remote 127.0.0.1:5110] mod_wsgi (pid=3574): Target WSGI script '/etc/ckan/datapusher.wsgi' cannot be loaded as Python module.
[Mon Aug 19 13:35:05.648319 2019] [wsgi:error] [pid 3574:tid 139753588152064] [remote 127.0.0.1:5110] mod_wsgi (pid=3574): Exception occurred processing WSGI script '/etc/ckan/datapusher.wsgi'.
[Mon Aug 19 13:35:05.648376 2019] [wsgi:error] [pid 3574:tid 139753588152064] [remote 127.0.0.1:5110] Traceback (most recent call last):
[Mon Aug 19 13:35:05.648407 2019] [wsgi:error] [pid 3574:tid 139753588152064] [remote 127.0.0.1:5110]   File "/etc/ckan/datapusher.wsgi", line 8, in <module>
[Mon Aug 19 13:35:05.648470 2019] [wsgi:error] [pid 3574:tid 139753588152064] [remote 127.0.0.1:5110]     import ckanserviceprovider.web as web
[Mon Aug 19 13:35:05.648524 2019] [wsgi:error] [pid 3574:tid 139753588152064] [remote 127.0.0.1:5110]   File "/usr/lib/ckan/datapusher/lib/python2.7/site-packages/ckanserviceprovider/web.py", line 13, in <module>
[Mon Aug 19 13:35:05.648571 2019] [wsgi:error] [pid 3574:tid 139753588152064] [remote 127.0.0.1:5110]     import flask.ext.login as flogin
[Mon Aug 19 13:35:05.648607 2019] [wsgi:error] [pid 3574:tid 139753588152064] [remote 127.0.0.1:5110] ImportError: No module named ext.login

Solution

Update the latest version of Flask:

pip uninstall flask
pip install flask==0.12
pip install flask-login

Patch the /usr/lib/ckan/datapusher/lib/python2.7/site-packages/ckanserviceprovider/web.py and replace import flask.ext.login as flogin with import flask_login as flogin

Restart datastore and ckan service:

sudo a2ensite datapusher
sudo service apache2 restart

Check the http://127.0.0.1:8800:

image

And the “Upload to DataStore” function should be fixed:

image

Reference

Datapusher: 500 Server Error