PyPI發佈 Django App

PyPI發佈 Django App

#0 GitHub

https://github.com/Coxhuang/DjangoApp-commit-PyPI

#1 環境

Python3.6

#2 開始

#2.1 安裝twine

pip3 install twine

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

.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目錄下新建以下文件
LICENSE  # 許可證
MANIFEST.in # 把不是.py結尾的文件一起打包(如果沒有該文件,默認只打包py文件)
README.md # 項目描述 
setup.py # 配置文件 

#2.3 MANIFEST.in

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

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='[email protected]',
    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 發佈

  • 回到包的目錄下
# 打包
python3 setup.py sdist
# 發佈
twine upload dist/*

20190403101203-image.png

下載

pip3 install django-google-auth2==0.0.8
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章