views:

44

answers:

3

Has anyone run into an idea of a "settings app" for a django project?

It's a set of application variables set by an administrator (not developer, so settings.py fails) using admin panel.

Are there any apps ready to use?

edit I probably didn't state my question clear. I don't mean editing the things like connection settings, rather things like "file size limit".

A: 

The question is how would you store the settings.

Cause... if you store the settings in the database it will be troublesome since most of the code will already be initialized (using the settings before that) before you have a database connection.

If it's the filesystem that means you're going to have to include a Python file that's being modified by your webserver which sounds like a huge security risk to me.

So... in my opinion, it could be done but I would vote against it since it's dangerous. If things should be configurable from the web, implement that in the app :)

WoLpH
+2  A: 

It sounds a bit like you're asking "how does an administrator change the settings (like database connection parameters) without changing settings.py?"

If your admin isn't familiar enough with python to change the settings.py file directly, you might consider giving the admin a simpler file to edit, perhaps a config file that you loaded from settings.py. Then all your admin has to do is edit the config file and restart the server.

This has an added benefit that you can limit the config file to only those parameters which your admin would need to mess with (like database connection parameters).

(Another option would be to get a better admin ...)

Seth
+1: We handled this in a different (an probably not as good) way as the config file method. We have a `try/except` for `local_early_settings.py` and `local_late_settings.py` that are checked near the top and bottom of the main settings.py file. These were originally meant to allow different settings in various developer's separate workspaces, but it has also been useful when one of our less-knowledgeable people screws up one of the early/late files. Oh, and these two files are also listed in the .hgignore file so they don't accidentally end up in production.
Peter Rowell
i wouldn't let site admin (i don't mean a dba or sysadmin) to change db connection settings.
halish
+2  A: 

There is a very nice app that does this, called django-dbsettings. The official repo hasn't been updated in years, but I have an up-to-date fork on my github page.

Daniel Roseman
thanks, i wanted to know whether somebody uses such approach. i ended up with making my own app for dbsettings (i just need few settings), with a model for each group of settings (like FileSizeLimitsModel). i also made some custom tags, so they are visible in every view i need.
halish