opinkerfi/adagios — pull request #160 by UnwashedMeme (2013-05-29 16:44:37+00:00)
Title: Use absolute python module references

The current setup of urls and python packages is brittle because it uses relative imports everywhere and modifies the python path to make it work.

It would work as long as adagios/adagios has been added to the path, which generally happens when using manage.py runserver or is being done manually (but poorly) in [adagios/adagios/wsgi.py](https://github.com/opinkerfi/adagios/blob/master/adagios/wsgi.py).

```python
from distutils.sysconfig import get_python_lib
pkgs_path = get_python_lib()
app_name = 'adagios'
path = '%s/%s' % (pkgs_path, app_name)
if path not in sys.path:
sys.path.append(path)
```

On my Ubuntu 12.04 system `get_python_lib()` returns `/usr/lib/python2.7/dist-packages`, but a `git clone ...; cd adagios; python setup.py install` goes into `/usr/local/lib/python2.7/dist-packages/adagios`

==== Steps to reproduce
```sh
$ git clone ...
$ cd adagios
$ virtualenv-2.7 --prompt='(adagios)' .ve
$ . .ve/bin/activate
$ pip install 'django<1.4'
$ pip install pynag==0.4.9
$ pip install -e . #install in dev mode.
$ DJANGO_SETTINGS_MODULE='adagios.settings' django-admin.py runserver
```

I am being a little bit non-standard in the last line (the norm being to cd into adagios and use ./manage.py) but this demonstrates the problem that wsgi will have on systems where `get_python_lib` doesn't return exactly as expected.

By changing all the python imports to be fully qualified we can do away with all the path modification and it should just work on different installations of python.