I want to throw in an idea related to apps. Hugo, Sune, and I had a 
discussion some time ago about get_absolute_url() in models. My idea is 
totally half-baked, undetailed, and flawed. I want to collect some input and 
your ideas.

Basically I was thinking about settings.py-style file for apps. In this file 
you may overwrite database table names used by the app (variation: prefix of 
table names), urls, maybe something else (e.g., external references). This 
file will reference the app itself.

The idea is to be able to do following things:

1) Create portable but customizable apps.
2) Reference the app in downloaded Python egg.
3) Use one app in two or more places on the same web site.
4) Use the same app without core changes on different web sites.

With it you can create truly portable apps, which doesn't require manual 
tweaking. We can have a repository of such apps.

>From end user (web site designer) it should work like this:

1) Main setting.py specifies a list of installed apps. (We already have it).
2) This list is enough to chain app urls in main urls.py list. (One possible 
implementation is to have a special command in urls.py to chain all 
unreferenced apps at that point).
3) The main file for an app is going to be apps/appname/settings.py, which 
references actual app code. By default it is a directory it is in. Or it may 
be some other directory/egg. If settings.py is not present, some default 
settings are assumed, which should be totally compatible with existing set 
up.
4) Web developer overrides some app settings in settings.py, e.g., table 
names for models, or url patterns for views.
5) Web developer overrides/adds templates in the same fashion it is done 
now. (I assume that template loading search for template in the 
templates/appname/ directory first, in the appdir/templates next.)
6) Done.

I think it solves portability problem while being fully backward compatible.

What did I miss? Give me your critique, input, alternative ideas, 
alternative scenarios, and whatever related thoughts you have.

Thanks,

Eugene



Reply via email to