GeoNode/geonode — pull request #225 by matthewhanson (2012-04-26 15:06:14+00:00)
Title: Clean settings.py

Cleaned up the settings.py file, which was confusing in many respects and had some no longer necessary settings (ADMIN_MEDIA_PREFIX). Also added lots of comments throughout.

I organized the settings into groups, with PRODUCTION vs DEVELOPMENT settings near the top, followed by SITE SPECIFIC settings (SITE ID, URL, NAME, etc), and settings that are likely to remain unchanged toward the end.

I also cleaned up the locations of things: media, static, etc. The default settings were confusing: static was set to media, media was set to site_media, among other things. I added comments to clarify what each setting was, and also when it was used (for example SITE_ROOT is never used in development, and GEONODE_ROOT needs to go under the static directory).

Part of the clean up involved renaming the media/ directory to static/ which required some edits to pavement.py as that is hard-coded to extract things to media/ (furthermore, pavement.py actually extracted to two different locations: media/ and media/static/ creating two complete copies of geonode-client).

To make the transition between production and development easier it meant streamlining some things and trying to reduce the amount of changes between the two. As such I had to edit shared/dev-paste.ini to add a proxy to GeoNetwork (which exists on production, but hadn't when running the development server).

There's a DEVELOPMENT setting now at the top of the settings file, which will determine DEBUG as well as SERVE_MEDIA....it will also change the SITEURL to localhost (otherwise set SITEURL to the real production URL).

Since the settings file is the first thing users will change, I think this is a very low-risk change. The name change of media to static improves clarity, but could cause a hiccup in an upgrade.

I would further suggest (not in this pull request) that the settings.py be renamed to settings_template.py to avoid clobbering changes during upgrades or push/pulls. This way if you take settings_template to create your own settings, but will always have a copy of the original geonode defaults. Also during upgrades you will get the new settings_template.py file which can be examined for required changes to incorporate into your own settings.py file.