On 12/8/06, leanmeandonothingmachine <[EMAIL PROTECTED]> wrote: > > Noob question: I've just started getting into django, and wanted to get > opinions on auto generating url patterns from a db. Is that bad > practice, will it slow down the site?
Depends on exactly what you are planning, and how efficient your 'auto' process is. If you are looking to auto-generate a static set of URLPatterns, then it will be no more inefficient than if you manually generated the URLPatterns. Of course, this assumes that your auto-generator produces an efficient set of regular expressions - while this is certainly possible, I would have thought a manually generated set would be more likely to be efficient. Another alternative would be to replace the RE based URLPatterns with a dynamic, DB introspecting system. However, given that this would involve more DB traffic, I would be surprised if this was any faster than the RE based approach. It sounds to me like the solution is to get a little more adventurous with your use of regular expressions in the existing URLpatterns structure. You can get as complex as you want in your RE definitions, capturing named arguments etc; these arguments can then be provided to a nicely generic view function. In my experience, the URLpatterns framework is fairly flexible - possibly more flexible than you realize. If you provide some concrete examples of what you want to acheive, maybe we can help you get where you want to be without reinventing the URL dispatch wheel. Yours, Russ Magee %-) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---