前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >PyPI发布 Django App

PyPI发布 Django App

作者头像
Autooooooo
发布2020-11-09 09:46:03
5070
发布2020-11-09 09:46:03
举报
文章被收录于专栏:Coxhuang

PyPI发布 Django App

#0 GitHub

代码语言:javascript
复制
https://github.com/Coxhuang/DjangoApp-commit-PyPI

#1 环境

代码语言:javascript
复制
Python3.6

#2 开始

#2.1 安装twine

代码语言:javascript
复制
pip3 install twine

#2.2 新建包(我的包名叫django-google-auth)

代码语言:javascript
复制
.django-google-auth

├── LICENSE 
├── MANIFEST.in 
├── README.md
├── django_google_auth2 # django App
│   ├── __init__.py
│   ├── admin.py
│   ├── apps.py
│   ├── google
│   ├── migrations
│   ├── models.py
│   ├── templates
│   ├── templatetags
│   ├── tests.py
│   ├── urls.py
│   ├── utils
│   └── views.py
└── setup.py
  • 把django app拷贝到django-google-auth目录下
  • 在django-google-auth目录下新建以下文件
代码语言:javascript
复制
LICENSE  # 许可证
MANIFEST.in # 把不是.py结尾的文件一起打包(如果没有该文件,默认只打包py文件)
README.md # 项目描述 
setup.py # 配置文件 

#2.3 MANIFEST.in

代码语言:javascript
复制
include LICENSE 
include README.md
recursive-include django_google_auth2/google * # django_google_auth2/google * 下的所有文件全部打包
recursive-include django_google_auth2/utils *
recursive-include django_google_auth2/templatetags *
recursive-include django_google_auth2/migrations *
recursive-include django_google_auth2/templates *

#2.4 setup.py

代码语言:javascript
复制
import os
from setuptools import find_packages, setup

with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
    README = readme.read()

# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))

setup(
    name='django-google-auth2',
    version='0.0.8',
    packages=find_packages(),
    include_package_data=True,
    license='BSD License', # example license
    description='django-google-auth2 project is demo application for google auth ',
    long_description=README,
    url='https://github.com/Coxhuang/django-google-auth',
    author='黄民航',
    author_email='gmhesat@gmail.com',
    classifiers=[
        'Environment :: Web Environment',
        'Framework :: Django',
        'Framework :: Django :: 2.0', # replace "X.Y" as appropriate
        'Intended Audience :: Developers',
        'License :: OSI Approved :: BSD License', # example license
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        # Replace these appropriately if you are stuck on Python 2.
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 3.6',
    ],
)

#3 发布

  • 回到包的目录下
代码语言:javascript
复制
# 打包
python3 setup.py sdist
代码语言:javascript
复制
# 发布
twine upload dist/*

下载

代码语言:javascript
复制
pip3 install django-google-auth2==0.0.8
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019/04/03 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • PyPI发布 Django App
  • #0 GitHub
  • #1 环境
  • #2 开始
    • #2.1 安装twine
      • #2.2 新建包(我的包名叫django-google-auth)
        • #2.3 MANIFEST.in
          • #2.4 setup.py
          • #3 发布
          • 下载
          领券
          问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档