发布 pypi 包(更新)

Posted by JC on 2021-09-10 17:02:01 Updated on 2021-09-10 17:02:01

集成 go-fastdfs 作为 Django 的静态文件存储后端

已发布至 pypi: https://pypi.org/project/django-gofastdfs-storage

# pip 安装
pip install django-gofastdfs-storage

# settings.py 中配置
STATICFILES_STORAGE = 'django_gofastdfs_storage.backends.StaticStorage'
DEFAULT_FILE_STORAGE = 'django_gofastdfs_storage.backends.MediaStorage'

GOFASTDFS_ENDPOINT=''
GOFASTDFS_AUTH_TOKEN=''
GOFASTDFS_BUCKET_NAME='djangoadmin'

发布至 pypi

参考:https://packaging.python.org/tutorials/packaging-projects/

先在 pypi 注册一个帐号,参照 setup.py 写好名称/功能描述

# 编辑 ~/.pypirc 填好用户名和密码

[distutils]
index-servers =
    pypi

[pypi]
repository: <https://upload.pypi.org/legacy/>
username: 
password: 

# 安装打包工具
python3 -m pip install --upgrade build
# 打包
python3 -m build
# 安装上传工具
python3 -m pip install --upgrade twine
# 上传
python3 -m twine upload --repository pypi dist/*