1

Hello I'm having a problem when trying to run server from an Django 2.0 old project.

this is the error:

      File "/usr/lib/python3.7/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.'

this is my urls.py

from django.conf.urls import url, include
from django.contrib import admin
from apps.sysgrub.views import LoginUser, LogoutUser

app_name = 'apps'

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^alumno/', include ('apps.alumno.urls', namespace="alumno")),
    url(r'^grupo/', include ('apps.grupo.urls', namespace="grupo")),
    url(r'^maestro/', include ('apps.maestro.urls', namespace="maestro")),
    url(r'^rol/', include ('apps.rol.urls', namespace="rol")),
    url(r'^sysgrub/', include ('apps.sysgrub.urls', namespace="sysgrub")),
    url(r'^$', LoginUser),
    url(r'^logout/$', LogoutUser),
]

and my urls by app

urlpatterns = [
url(r'^index$', index),
url(r'^horarios$', horarios),
url(r'^listar$', Alumno_grupoList.as_view(), name='alumno_listar'),
url(r'^agregar$', AlumnoCreate.as_view(), name='add_student'),

]

thank you so much for your help greetings.

Mexa Fireg
  • 83
  • 2
  • 9
  • 3
    You must have an `app_name` variable in each of the modules you include that way. (`apps.alumno.urls` etc.) You don't need app_name in the root urls.py. – Håken Lid Oct 31 '18 at 22:59
  • Possible duplicate of ['Specifying a namespace in include() without providing an app\_name'](https://stackoverflow.com/questions/48608894/specifying-a-namespace-in-include-without-providing-an-app-name) – Håken Lid Oct 31 '18 at 23:01
  • Thank you that was the problem. Have an excellent day. – Mexa Fireg Oct 31 '18 at 23:08

1 Answers1

0

The error describes the resolution please remove app name from the urls.py as below

urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^alumno/', include ('alumno.urls', namespace="alumno")),
url(r'^grupo/', include ('grupo.urls', namespace="grupo")),
]
Anoop Kumar
  • 845
  • 1
  • 8
  • 19