[3.0.x] Fixed #30944 -- Changed reusable apps docs to use a declarative config.

Backport of 89368ab6e3 from master
This commit is contained in:
Jon Dufresne 2019-11-01 17:37:12 -07:00 committed by Carlton Gibson
parent a5b4a909f0
commit 85cddb6abb
1 changed files with 41 additions and 40 deletions

View File

@ -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
<https://setuptools.readthedocs.io/en/latest/>`_ 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
<https://setuptools.readthedocs.io/en/latest/>`_ 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