Thanks for checking into what the Django community says about this issue.
For the short term, I think the solution to our immediate need is to use a
urls.py.sample as you suggest. This will solve my immediate problem at
least.
Also, you say that the Django community has "bigger things in the works"
that may avoid the need for us to develop the "magic" dynamic urls.py
pattern generator. What sorts of things are those, and where can I read
about them?
btw, I agree that magic code should be avoided in the django engine itself,
however a module that when included as an app itself that explicitly
modifies the installation to behave in a "magic" way is acceptable, I think.
Best,
Brian
On Mon, Apr 26, 2010 at 11:11 PM, Eric D Helms <baelout(a)gmail.com> wrote:
I did some digging today on the Django developer's list about
solutions to
the dynamix population of urls.py based on a setting in the settings.py
file. A little bit of history, it would appear they discussed this very
concept 4ish years ago. There has also been a good amount of discussion
related to revamping the application loading process of Django in order to
make it more straightforward. The complaint most often has is that if an
application is put under installed_apps, shouldn't that take care of all
this setup for you?
With that being said - the consensus against having a dynamic generator is
that it introduces code that is somewhat 'magical' and has more break
potential. (And a guiding principle of Django is to avoid 'magic' code at
all costs) Rather, the potential answer seems to lie in thinking about and
treating urls.py as a settings file itself. (And thus, a urls.py.sample
could be used for version control while urls.py contains your local
settings)
To reiterate the options:
1) Create a dynamic urls.py pattern generator for a custom setting in
settings.py that lists all applications that need a urls.py entry
2) Treat urls.py like a settings file and have a urls.py.sample for version
control
My opinion is that while the first option is more powerful, the second is
simpler to implement (and the Django community seems to have bigger things
in the works that would potentially handle this in future releases).
Eric Helms
_______________________________________________
Opus-devel mailing list
Opus-devel(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/opus-devel
--
Brian Bouterse
ITng Services