jezdez/django_compressor — Issue #197: Error on running `collectstatic` when project settings is a package
Author: etienned
Created: 2012-01-30 21:33:32+00:00
State: open

When running `collectstatic` on my statging server I got this traceback:

```shell
File "/home/user/virtualenvs/staging/lib/python2.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 79, in handle_noargs
for finder in finders.get_finders():
File "/home/user/virtualenvs/staging/lib/python2.6/site-packages/django/contrib/staticfiles/finders.py", line 242, in get_finders
yield get_finder(finder_path)
File "/home/user/virtualenvs/staging/lib/python2.6/site-packages/django/utils/functional.py", line 124, in wrapper
result = func(*args)
File "/home/user/virtualenvs/staging/lib/python2.6/site-packages/django/contrib/staticfiles/finders.py", line 251, in _get_finder
mod = import_module(module)
File "/home/user/virtualenvs/staging/lib/python2.6/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/home/user/virtualenvs/staging/lib/python2.6/site-packages/compressor/finders.py", line 1, in
from compressor.utils import staticfiles
File "/home/user/virtualenvs/staging/lib/python2.6/site-packages/compressor/utils/staticfiles.py", line 7, in
INSTALLED = ("staticfiles" in settings.INSTALLED_APPS or
AttributeError: 'module' object has no attribute 'INSTALLED_APPS'
```

My project settings is a package:

```
project/
settings/
__init__.py
settings_local.py
settings_staging.py
settings.py
```
`__init__.py` import only one of the others settings based on some criteria. And all `settings_*.py` start by `from settings import *` so they can override only what they need to.

What look strange to me is that I don't have this bug on my dev computer (using the `local`settings file)?

It's probably related to Appconf but I really don't know Appconf. I tried to change `from compressor.conf import settings` to `from django.conf import settings` in compressor/utils/staticfiles.py, but now it's not finding `COMPRESS_ROOT`.

```
...
File "/home/user/virtualenvs/staging/lib/python2.6/site-packages/compressor/storage.py", line 21, in __init__
location = settings.COMPRESS_ROOT
AttributeError: 'module' object has no attribute 'COMPRESS_ROOT'
```