On Sep 25, 9:59 am, dijxtra <nsko...@gmail.com> wrote:
> Hi everybody,
>
> Django applications, as I understood them should be pluginable on
> project basis. That is, I should be able to install them to my
> *project*, not to my django installation. So I downloaded django-
> tagging and run the python setup.py install. And it failed:
> n...@rilmir:~/code/my_project/django-tagging-0.3$ python setup.py
> install
> [...]
> creating /usr/local/lib/python2.6/dist-packages/tagging
> error: could not create '/usr/local/lib/python2.6/dist-packages/
> tagging': Permission denied
>
> Now, why is django-tagging trying to mess with my python directory?
> Does that mean that when I commit my project to my repository and
> checkout it on a different django installation django-tagging won't
> work untill I install django-tagging on that machine? I thought that
> when I install an django app, then I install it in my project and my
> project is still portable. But, if django-tagging is putting files in
> directories outside my project directory, doesn't that make my project
> un-portable?
>
> Could someone please clear this up for me?
>
First, this issue is a python packaging and distribution issue. There
is nothing specific to Django or Django apps which makes dependency
handling any easier over working with any other non-django python
distributions.
When you do:
$ python setup.py install
You are manually installing the django-tagging distribution. The
setup.py for a distribution will either invoke distutils or setuptools
to install this distribution in a global location for your python
interpreter. There are additional command-line switch you can supply
to install this distribution in a non-global location. Then you can
inform your Python interpreter of that location of this non-global
locatin using the PYTHONPATH environment variable. There are a variety
of home-grown solutions for managing this type of dependency
installation (shell scripts, symlinks, etc.).
But home-grown package handling tends to be rather unwieldy. The ideal
way to handle dependencies is to make your project a proper python
distribution (i.e. has a setup.py file), and then use one of the
python package installation tools (Buildout or Pip) to automatically
handle downloading and installation. Inside the setup.py file you can
use the 'install_requires' field (only supported by setuptools ATM,
but should be officially supported in Python 2.7/3.2). Your setup.py
would have a line such as:
install_requires = ['django-tagging','Django']
When Pip or Buildout install your project, it will read the
install_requires and automatically install Django and django-tagging.
You can further limit the versions selected for a particular install
(dev install or production install) by specifiying specific versions
of packages picked from specific package repositories, typically you
may pin down all versions in a production setting, where as you
development installs will freely pull down the newest releases of all
dependencies so you can test them in advance of promoting those
packages into production.
But again, there is nothing Django-specific about this, so if you have
other questions about python packaging, you may find (more or better)
answers on the Distutils-SIG mailing list.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---