Skip to content

Commit dd0d2c0

Browse files
committed
Fixed django#19216 - Switched to user level installation in apps tutorial.
Thanks Nick Coghlan for the suggestion.
1 parent 7f75460 commit dd0d2c0

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

docs/intro/reusable-apps.txt

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -291,16 +291,19 @@ Using your own package
291291
Since we moved the ``polls`` directory out of the project, it's no longer
292292
working. We'll now fix this by installing our new ``django-polls`` package.
293293

294-
.. admonition:: Installing as a system library
294+
.. admonition:: Installing as a user library
295295

296-
The following steps install ``django-polls`` as a system library. In
297-
general, it's best to avoid messing with your system libraries to avoid
298-
breaking things. For this simple example though, the risk is low and it will
299-
help with understanding packaging. We'll explain how to uninstall in
300-
step 4.
296+
The following steps install ``django-polls`` as a user library. Per-user
297+
installs have a lot of advantages over installing the package system-wide,
298+
such as being usable on systems where you don't have administrator access
299+
as well as preventing the package from affecting system services and other
300+
users of the machine. Python 2.6 added support for user libraries, so if
301+
you are using an older version this won't work, but Django 1.5 requires
302+
Python 2.6 or newer anyway.
301303

302-
For experienced users, a neater way to manage your packages is to use
303-
"virtualenv" (see below).
304+
Note that per-user installations can still affect the behavior of system
305+
tools that run as that user, so ``virtualenv`` is a more robust solution
306+
(see below).
304307

305308
1. Inside ``django-polls/dist``, untar the new package
306309
``django-polls-0.1.tar.gz`` (e.g. ``tar xzvf django-polls-0.1.tar.gz``). If
@@ -310,17 +313,17 @@ working. We'll now fix this by installing our new ``django-polls`` package.
310313
2. Change into the directory created in step 1 (e.g. ``cd django-polls-0.1``).
311314

312315
3. If you're using GNU/Linux, Mac OS X or some other flavor of Unix, enter the
313-
command ``sudo python setup.py install`` at the shell prompt. If you're
314-
using Windows, start up a command shell with administrator privileges and
315-
run the command ``setup.py install``.
316+
command ``python setup.py install --user`` at the shell prompt. If you're
317+
using Windows, start up a command shell and run the command
318+
``setup.py install --user``.
316319

317320
With luck, your Django project should now work correctly again. Run the
318321
server again to confirm this.
319322

320323
4. To uninstall the package, use pip (you already :ref:`installed it
321324
<installing-reusable-apps-prerequisites>`, right?)::
322325

323-
sudo pip uninstall django-polls
326+
pip uninstall django-polls
324327

325328
.. _bsdtar: http://gnuwin32.sourceforge.net/packages/bsdtar.htm
326329
.. _7-zip: http://www.7-zip.org/
@@ -347,11 +350,10 @@ is choosing the license under which your code is distributed.
347350
Installing Python packages with virtualenv
348351
==========================================
349352

350-
Earlier, we installed the polls app as a system library. This has some
353+
Earlier, we installed the polls app as a user library. This has some
351354
disadvantages:
352355

353-
* Modifying the system libraries can affect other Python software on your
354-
system.
356+
* Modifying the user libraries can affect other Python software on your system.
355357

356358
* You won't be able to run multiple versions of this package (or others with
357359
the same name).

0 commit comments

Comments
 (0)