From 85cddb6abb7eddf2d8cb5e3a845dcd16ec9f22cf Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Fri, 1 Nov 2019 17:37:12 -0700 Subject: [PATCH] [3.0.x] Fixed #30944 -- Changed reusable apps docs to use a declarative config. Backport of 89368ab6e358ebe29a0417d65209182238daa245 from master --- docs/intro/reusable-apps.txt | 81 ++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/docs/intro/reusable-apps.txt b/docs/intro/reusable-apps.txt index ba6f1ddd07..3041fbe8e9 100644 --- a/docs/intro/reusable-apps.txt +++ b/docs/intro/reusable-apps.txt @@ -181,50 +181,51 @@ this. For a small app like polls, this process isn't too difficult. license. Just be aware that your licensing choice will affect who is able to use your code. -#. Next we'll create a ``setup.py`` file which provides details about how to - build and install the app. A full explanation of this file is beyond the - scope of this tutorial, but the `setuptools docs - `_ have a good - explanation. Create a file ``django-polls/setup.py`` with the following - contents: +#. Next we'll create ``setup.cfg`` and ``setup.py`` files which detail how to + build and install the app. A full explanation of these files is beyond the + scope of this tutorial, but the `setuptools documentation + `_ has a good explanation. + Create the files ``django-polls/setup.cfg`` and ``django-polls/setup.py`` + with the following contents: + + .. code-block:: ini + :caption: django-polls/setup.cfg + + [metadata] + name = django-polls + version = 0.1 + description = A Django app to conduct Web-based polls. + long_description = file: README.rst + url = https://www.example.com/ + author = Your Name + author_email = yourname@example.com + license = BSD-3-Clause # Example license + classifiers = + Environment :: Web Environment + Framework :: Django + Framework :: Django :: X.Y # Replace "X.Y" as appropriate + Intended Audience :: Developers + License :: OSI Approved :: BSD License + Operating System :: OS Independent + Programming Language :: Python + Programming Language :: Python :: 3 + Programming Language :: Python :: 3 :: Only + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Topic :: Internet :: WWW/HTTP + Topic :: Internet :: WWW/HTTP :: Dynamic Content + + [options] + include_package_data = true + packages = find: .. code-block:: python - :caption: django-polls/setup.py + :caption: django-polls/setup.py - import os - from setuptools import find_packages, setup + from setuptools import setup - with open(os.path.join(os.path.dirname(__file__), 'README.rst')) 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-polls', - version='0.1', - packages=find_packages(), - include_package_data=True, - license='BSD License', # example license - description='A Django app to conduct Web-based polls.', - long_description=README, - url='https://www.example.com/', - author='Your Name', - author_email='yourname@example.com', - classifiers=[ - 'Environment :: Web Environment', - 'Framework :: Django', - 'Framework :: Django :: X.Y', # replace "X.Y" as appropriate - 'Intended Audience :: Developers', - 'License :: OSI Approved :: BSD License', # example license - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Topic :: Internet :: WWW/HTTP', - 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', - ], - ) + setup() #. Only Python modules and packages are included in the package by default. To include additional files, we'll need to create a ``MANIFEST.in`` file. The