使用amazon web服务的s3存储宿主资源文件
ckanext-s3filestore的Python项目详细描述
ckanext-s3filestore
使用amazon s3作为资源的文件存储。
要求
需要CKAN 2.5+
安装
要安装ckanext-s3filestore:
激活您的CKAN虚拟环境,例如:
. /usr/lib/ckan/default/bin/activate
将ckanext-s3filestore python包安装到虚拟环境中:
pip install ckanext-s3filestore
将s3filestore添加到ckan中的ckan.plugins设置 配置文件(默认情况下,配置文件位于 /etc/ckan/default/production.ini)。
重启ckan。例如,如果您在ubuntu上使用apache部署了ckan:
sudo service apache2 reload
配置设置
必需:
ckanext.s3filestore.aws_access_key_id = Your-AWS-Access-Key-ID ckanext.s3filestore.aws_secret_access_key = Your-AWS-Secret-Access-Key ckanext.s3filestore.aws_bucket_name = a-bucket-to-store-your-stuff
可选:
# An optional path to prepend to keys ckanext.s3filestore.aws_storage_path = my-site-name # An optional setting to fallback to filesystem for downloads ckanext.s3filestore.filesystem_download_fallback = true # The ckan storage path option must also be set correctly for the fallback to work ckan.storage_path = path/to/storage/directory
开发安装
要安装ckanext-s3filestore进行开发,请激活ckan virtualenv并 做:
git clone https://github.com/okfn/ckanext-s3filestore.git cd ckanext-s3filestore python setup.py develop pip install -r dev-requirements.txt pip install -r requirements.txt
运行测试
要运行测试,请执行:
nosetests --ckan --nologcapture --with-pylons=test.ini
要运行测试并生成覆盖率报告,首先确保 在您的virtualenv(pip install coverage)中安装覆盖率,然后运行:
nosetests --ckan --nologcapture --with-pylons=test.ini --with-coverage --cover-package=ckanext.s3filestore --cover-inclusive --cover-erase --cover-tests
在pypi上注册ckanext-s3filestore
ckanext-s3filestore应该在pypi as上可用 https://pypi.python.org/pypi/ckanext-s3filestore。如果链接不起作用,那么 您可以按照以下步骤第一次在pypi上注册项目 步骤:
创建项目的源分发版:
python setup.py sdist
注册项目:
python setup.py register
将源分发上载到pypi:
python setup.py sdist upload
在github上标记项目的第一个版本,版本号为 setup.py文件。例如,setup.py中的版本号是 0.0.1然后执行:
git tag 0.0.1 git push --tags
发布新版本的ckanext-s3filestore
ckanext-s3filestore作为https://pypi.python.org/pypi/ckanext-s3filestore在pypi上可用。 要将新版本发布到pypi,请执行以下步骤:
更新setup.py文件中的版本号。 见PEP 440 如何选择版本号。
创建新版本的源发行版:
python setup.py sdist
将源分发上载到pypi:
python setup.py sdist upload
在github上标记项目的新版本,版本号为 setup.py文件。例如,setup.py中的版本号是 0.0.2然后执行:
git tag 0.0.2 git push --tags