[1.6.x] Recommended setuptools in the reuseable app tutorial.

setuptools has merged with distribute.

Backport of b5eef8535a from master.
This commit is contained in:
Dražen Lučanin 2013-11-15 20:06:32 +01:00 committed by Tim Graham
parent 20e322f4bf
commit 6f48ae0b0f
1 changed files with 15 additions and 20 deletions

View File

@ -100,14 +100,14 @@ Installing some prerequisites
============================= =============================
The current state of Python packaging is a bit muddled with various tools. For The current state of Python packaging is a bit muddled with various tools. For
this tutorial, we're going to use distribute_ to build our package. It's a this tutorial, we're going to use setuptools_ to build our package. It's the
community-maintained fork of the older ``setuptools`` project. We'll also be recommended packaging tool (merged with the ``distribute`` fork). We'll also be
using `pip`_ to install and uninstall it. You should install these using `pip`_ to install and uninstall it. You should install these
two packages now. If you need help, you can refer to :ref:`how to install two packages now. If you need help, you can refer to :ref:`how to install
Django with pip<installing-official-release>`. You can install ``distribute`` Django with pip<installing-official-release>`. You can install ``setuptools``
the same way. the same way.
.. _distribute: http://pypi.python.org/pypi/distribute .. _setuptools: https://pypi.python.org/pypi/setuptools
.. _pip: http://pypi.python.org/pypi/pip .. _pip: http://pypi.python.org/pypi/pip
Packaging your app Packaging your app
@ -163,17 +163,18 @@ this. For a small app like polls, this process isn't too difficult.
5. Visit http://127.0.0.1:8000/polls/ to participate in the poll. 5. Visit http://127.0.0.1:8000/polls/ to participate in the poll.
4. Create a ``django-polls/LICENSE`` file. Choosing a license is beyond the 4. Create a ``django-polls/LICENSE`` file. Choosing a license is beyond the
scope of this tutorial, but suffice it to say that code released publicly scope of this tutorial, but suffice it to say that code released publicly
without a license is *useless*. Django and many Django-compatible apps are without a license is *useless*. Django and many Django-compatible apps are
distributed under the BSD license; however, you're free to pick your own distributed under the BSD license; however, you're free to pick your own
license. Just be aware that your licensing choice will affect who is able license. Just be aware that your licensing choice will affect who is able
to use your code. to use your code.
5. Next we'll create a ``setup.py`` file which provides details about how to 5. 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 build and install the app. A full explanation of this file is beyond the
scope of this tutorial, but the `distribute docs scope of this tutorial, but the `setuptools docs
<http://packages.python.org/distribute/setuptools.html>`_ have a good explanation. <http://packages.python.org/setuptools/setuptools.html>`_ have a good
Create a file ``django-polls/setup.py`` with the following contents:: explanation. Create a file ``django-polls/setup.py`` with the following
contents::
import os import os
from setuptools import setup from setuptools import setup
@ -208,15 +209,9 @@ Create a file ``django-polls/setup.py`` with the following contents::
], ],
) )
.. admonition:: I thought you said we were going to use ``distribute``?
Distribute is a drop-in replacement for ``setuptools``. Even though we
appear to import from ``setuptools``, since we have ``distribute``
installed, it will override the import.
6. Only Python modules and packages are included in the package by default. To 6. 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 include additional files, we'll need to create a ``MANIFEST.in`` file. The
distribute docs referred to in the previous step discuss this file in more setuptools docs referred to in the previous step discuss this file in more
details. To include the templates, the ``README.rst`` and our ``LICENSE`` details. To include the templates, the ``README.rst`` and our ``LICENSE``
file, create a file ``django-polls/MANIFEST.in`` with the following file, create a file ``django-polls/MANIFEST.in`` with the following
contents:: contents::