I think the standard approach you mentioned is best; create a folder settings
with three settings files; shared.py
, production.py
and development.py
. Settings that are common to all instances of your app are placed in shared.py
and this is imported from production.py
and development.py
. Then you can easily only add compressor
in your development settings
shared.py
INSTALLED_APPS = (...)
development.py
from settings.shared import *
INSTALLED_APPS += ('compressor',)
You need to make sure then when developing, you run the development server with the development.py
settings file:
python manage.py --settings=settings.development
and similarly on your production server you do the same for production.py
(this is down to your implementation)
This is a much better approach in the long term as you can also specify separate cache, database, search etc. settings too.
As an aside, instead of completely removing compressor
from your installed apps, you can simply enable and disable is using it's COMPRESS_ENABLED
setting
COMPRESSOR_ENABLED
setting, if I set it to FALSE I am still left with templates that have the{% compress js %}
and{% endcompress %}
which then break on the server. Is there a way to makedjango-compressor
remake the template files without these tags? This question I made is about this #9393493 Thanks for the help on this question and any help on the other questions. – Pella