Django: resolve (request.path) .app_name does not return application name

I am trying to access the current application name from a view or template.

Other SO answers How to get application name using python in django and How to get current application in Django I found that resolve(request.path).app_name should return the current application name. But in my case, it also returns “No”.

I am using Django 1.3.

+4
source share
1 answer

To do this, you need to pass the app_name parameter when you include your URLs:

 #urls.py urlpatterns = patterns('', (r'^manufacturers/', include('manufacturers.urls', app_name='manufacturers')), ) #shell output In [1]: resolve('/manufacturers/my_manufacturers/').app_name Out[1]: 'manufacturers' 

Additional Information: Defining URL Namespaces

+7
source

All Articles