Setting up for python django development with Debian Linux

Ben Finney ben+python at benfinney.id.au
Mon Oct 28 19:05:25 EDT 2013


Gary Roach <gary719_list1 at verizon.net> writes:

> I have been trying to set up a python, django, mysql,
> virtualenvwrapper and git development project and am really confused.

(Side note: If you have the option, avoid MySQL and begin with
PostgreSQL. It is much more standards-compliant, and avoids many of the
misfeatures and never-fixed bugs in MySQL that will cause you great
grief.)

> All of the documentation seems to ignore the apt-get installation
> methods used by Debian Linux and its derivatives.

Do you mean the Django documentation?

> Does pip install the same as apt-get; I don't think so. If I use
> virtualenvwrapper, how does this fit with the normal debian (wheezy)
> installation.

You're right, it doesn't. Pip is one step on a long, incomplete progress
of the Python community's attempt to implement dependency-based package
management. It lacks many of the useful features you've come to expect
from modern operating system package managers.

Not least: if your project has any dependencies other than Python
packages, pip cannot help you since it is tied to Python's Distutils.

> I also need git which just confuses the situation even more. Must I
> give up the automatic updating system that Debian provides when
> setting up the development environment?

No, you can develop your project on the assumption that APT is available
and that particular repositories will be used. Then you are bound to
only depend on those packages available from those repositories.

There is a huge range of Python packages, Django-specific packages, and
of course non-Python packages, in Debian. So you may find that this will
work fine for you.

But be aware that (unfortunately, in my view) many Python developers do
not want to wait for libraries to be quality-tested in an operating
system's ecosystem; they want to grab each one as soon as it's available
and immediately depend on the latest version.

It is for this desire that installing directly from PyPI is implemented.
And for this, you do indeed abandon the operating system's package
management and all the benefits it brings.

> The documentation centers on Windoz, Mac and generic Linux
> distributions and ignores the automation of the Debian installation.

Yes. Python (and Django) are designed for a range of operating systems,
on some of which package dependency management is nonexistent (MS
Windows) or atrocious (OS/X).

Dependency-based package management is a mature technology with
implementations that avoid many of the problems in pip, but pip serves a
real need: bringing some measure of dependency-based package management
to at least Python libraries, in operating systems that lack anything
better.

> Any help with straightening out my brain in this area will be
> sincerely appreciated.

If you're fortunate enough to be developing on a modern operating system
with dependency-based package management and a rich repository of OS
packages, like Debian, then you can develop software as for anything
else where the packages are available in the OS: ignore pip, and package
your software to depend on other operating system packages.

The Python and Django documentation aren't going to be of much help
there, since they don't try to teach people to package their software to
work with the rest of the operating system (instead advising developers
to pretend the rest of the operating system doesn't exist, insulating
the developer's software in a virtualenv). So you'll need to learn how
to package software for Debian yourself.

-- 
 \       "Those who will not reason, are bigots, those who cannot, are |
  `\        fools, and those who dare not, are slaves." —“Lord” George |
_o__)                                                Gordon Noel Byron |
Ben Finney




More information about the Python-list mailing list