I don't know how useful this will be as it's mostly a 'this is how we tackled the problem'. I haven't worked out how your parameters are passed to the views, so it's possible you may be interested
On 02/01/11 11:17, Alex Kamedov wrote: > INSTALLED_APPS will be low level API to install applications. I > propose install application through > `install_applications` function like this: > > from django.core.apps import install_applications > > INSTALLED_APPS = install_applications( > 'django.contrib.contenttypes', > 'django.contrib.sessions', > ... > auth = 'django.contrib.auth', > comments = 'django.contrib.comments' > gallery = App(path='my_gallery', db_prefix='new_gallery', > verbose_name=u'My new gallery') > ) > > [snip] I developed something akin to this for the Molly project¹ (a framework-on-a-framework), albeit using an APPLICATION setting instead of the INSTALLED_APPS setting (so as not to have to hack Django itself): > APPLICATIONS = [ > … Application('molly.apps.z3950', 'library', 'Library search', > verbose_name = 'Oxford Library Information System', > host = 'library.ox.ac.uk', > database = 'MAIN*BIBMAST', > ), > ] The signature is Application(app_path, app_name, title, **params). INSTALLED_APPS then has the app paths from APPLICATIONS appended to it to keep the rest of Django happy ('normal' Django apps are handled as before). We stuck with a list as the order is when displaying apps on the homepage. We took this route so that we could parameterize apps without having a profusion of settings. It also lets us have multiple instances of apps with different parameters. Application objects can be retrieved by name or package path, and they have a urls attribute that contains a resolver. It's hacky, but the urls attribute is constructing by walking the app's urls.urlpatterns and initialising each class-based view with the params. This manifests as a conf attribute on view instances. If you're interested, see an example root urlconf², our hacky infrastructure³, and an app using this stuff⁴. Hope this is of some use! Alex ¹ http://github.com/mollyproject/mollyproject ² https://github.com/mollyproject/mollyproject/blob/6ab2d4f/demos/molly_oxford/urls.py ³ https://github.com/mollyproject/mollyproject/tree/6ab2d4f/molly/conf/settings.py ⁴ https://github.com/mollyproject/mollyproject/blob/6ab2d4f/molly/apps/contact/views.py -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.