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

Manuel Santi
  • 1,106
  • 17
  • 46
  • Check the answer here -> https://stackoverflow.com/questions/48608894/impropyconfigurederror-about-app-name-when-using-namespace-in-include – Gabriel Nov 21 '19 at 10:24
  • one possible solution is, to remove namespace and then run migrations – Vikas Gautam Nov 21 '19 at 10:24

2 Answers2

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.

Will
  • 792
  • 1
  • 5
  • 22
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


]
Salton
  • 1
  • 1
  • 1
    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](/help/how-to-answer). – Community Aug 19 '23 at 15:22