0

I have a django site with 3 application. in my urls.py i try to include the specific app's url in this fashion:

url(r'^oferty/', include('oferty.urls', namespace='oferty')),

but when i start or migrate my app i get this error:

../site-packages/django/urls/conf.py", line 39, in include 'Specifying a namespace in include() without providing an app_name ' django.core.exceptions.ImproperlyConfigured: Specifying a namespace in include() without providing an app_name is not supported. Set the app_name attribute in the included module, or pass a 2-tuple containing the list of patterns and app_name instead.

How can i include apps urls in my main url.py file? I use django 2.2

so many thanks in advance

2
  • Check the answer here -> stackoverflow.com/questions/48608894/… Commented Nov 21, 2019 at 10:24
  • one possible solution is, to remove namespace and then run migrations Commented Nov 21, 2019 at 10:24

2 Answers 2

0

You need to define variable app_name in your file: oferty/urls.py

see example here: https://docs.djangoproject.com/en/2.2/topics/http/urls/#id5

or simply remove namespace.

Sign up to request clarification or add additional context in comments.

Comments

0

in my_app

from django.urls import path
from . import views
urlpatterns = [
    path('/', views.home, name="home"),

]

in main project urls

from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path('', include('myapp.urls')),  # Include myapp URLs


]

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.