BinaryRage/OSQA — pull request #33 by cdman (2012-05-31 18:40:08+00:00)
Title: Added settings import/export command to management script

This adds two commands to manage.py: dump_settings and update_settings. These can be useful if you're running a network of sites and want to keep some kind of similarity between the setting set on each.

Usage:

python manage.py dump_settings > settings_osqa.py

In settings_osqa.py replace ^settings\. with SETTINGS. and add:
class SettingsHolder:
dict = {}
def __setattr__(self, name, value):
self.dict[name] = value

SETTINGS = SettingsHolder()

You can even add more custom code like the following (to make the installation relocable):
import os.path
file_path = os.path.dirname(os.path.abspath(__file__))
SETTINGS.UPFILES_FOLDER = os.path.join(file_path, 'forum', 'upfiles', '')

Then:

python manage.py load_settings

Only settings which are set to their default values are updated. This is a precaution to avoid overwriting customized settings.