Open lopezjurip opened 6 years ago
with which value?
Use app_name='nameapp' in urls for applications, after urlpatterns
Can you provide a code example? Because as I'm typing app_name="sth" in urls.py it doesn't work.
Can you provide a code example? Because as I'm typing app_name="sth" in urls.py it doesn't work.
Let's say in your main urls.py
you want to include the urls of an app, called shop_app
, like this:
path("shop/", include("shop_app.urls", namespace='shop')),
Then, in your urls.py
file of your shop_app
located in shop_app/urls.py
, after the urlpatters add the app_name
like this:
urlpatterns = [
... some patterns
]
app_name = 'shop'
If you don't have access to the shop_app
urls, as in case you are using an included package, then you'll have to drop the namespace
from your main include and remove the namespace references from your url
tags, or from your reverse
functions.
Or you can also use it this way:
path('mfa/', include(("deux.urls", 'app_name'), namespace="mfa")),
Excelent ¡¡¡
as indicated by @DonExo
path('', include(('blog.urls', 'blog'), namespace='blog'))
When using this library with Django 2 like:
Fails with:
To make this work we need to add the variable
app_name
todeux/urls.py deux/oauth2/urls.py deux/authtoken/urls.py