问题
When trying to upload a file to a dataset in CKAN, I get this error in the web interface:
Failed to get credentials for storage upload. Upload cannot proceed
回答1:
This error is usually caused either by CKAN's FileStore not being setup correctly, or the FileStore's dependencies not being installed correctly. See CKAN's FileStore and File Uploads documentation.
Make sure that:
You have
pairtree
installed in your CKAN virtualenv (pip install pairtree
)You have
argparse
installed in your CKAN virtualenv (pip install argparse
)You have the
ofs.impl
andofs.storage_dir
options set correctly in the[app:main]
section of your CKAN ini file, e.g.:ofs.impl = pairtree ofs.storage_dir = /mnt/datalocale
Make sure that your
ofs.storage_dir
directory exists. Run this command in a shell:mkdir -p /path/to/your/ofs/storage/dir
.Make sure that the operating system user that CKAN runs as (e.g. the user
www-data
, if you are running CKAN with Apache on Ubuntu) has read and write permissions for theofs.storage_dir
. For example, if you are running CKAN with Apache on Ubuntu, run these commands in the terminal:sudo chown www-data /path/to/your/ofs/storage_dir sudo chmod u+rwx /path/to/your/ofs/storage_dir sudo service apache2 restart
If all of the above fails then ask for help, either using this CKAN tag on StackOverflow or the ckan-dev mailing list. When posting, it is useful to include:
- What operating system you're using
- What version of CKAN you're using
- How you have deployed CKAN (package install or source install? Apache webserver or paster development install?)
- Your CKAN ini file (with any sensitive details removed)
- Any errors you get from CKAN, either from the terminal where you're running
paster serve ...
or, if you're running CKAN with Apache, from a log file such as/var/log/apache2/YOURSITE.error.log
. If you can get us a full Python traceback, this is usually the most useful thing. - The output of the
pip freeze
command when run in your CKAN virtualenv.
回答2:
If the older answer doesn't work out, then there is a chance that you don't have the One other option to check, especially if you don't run CKAN at the root url (/), is whether or not the ckan.api_url
is set properly. This configuration is not automatically set from ckan.site_url
(which it should be), and if CKAN is installed on a sub-path, like /ckan/, any API calls that are made from Javascript will fail. An additional configuration to try would be to set ckan.api_url
to be the same as ckan.site_url
.
来源:https://stackoverflow.com/questions/13971622/error-when-trying-to-upload-a-file-to-ckan-failed-to-get-credentials-for-stora