tags:

views:

41

answers:

1

Django tutorials everywhere use constant-set application name all around - in urls file, in HTML templates, in views. But if I want to distribute an application and let the user sets it name (i.e. its URL postfix on http://server.com/appname) - how can I do?

I must have some common name setting then in configuration, but how to work it for template files, etc?

+1  A: 

The only thing that matters with reference to the URL is the app's urlconf. As long as you do your imports via the app's package, e.g. appname.models, appname.views, etc., all consumers of your app will have to do after installation is add it to their INSTALLED_APPS and include() it in their urlconf. Everything else will be found by Django provided they are in their default locations.

Ignacio Vazquez-Abrams
and what about url matching in urls.py, which starts with app name?
zaharpopov
Entries in the app's urls.py should not need to start with the app name. Where the app is rooted should be determined by the project, not the app.
Ignacio Vazquez-Abrams