Problems with URL in Django

2

I have an application in django that runs perfectly on the test server, but when it comes to deploying with the Mod_WSGI it gives me the following error

http://localhost/ingresar?next=/Terry/

The requested URL / enter was not found on this server.

these are my urls.py

from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.conf import settings
admin.autodiscover()
import xadmin
xadmin.autodiscover()

urlpatterns = patterns('',
    url(r'^$','principal.views.inicio'),
    url(r'^usuarios/$','principal.views.usuarios'),
    url(r'^sobre/$','principal.views.sobre'),
    url(r'^evento/$','principal.views.lista_eventos'),
    url(r'^nuevo/$','principal.views.nuevoevento'),
    url(r'^temporadas/$','principal.views.temporadas'),
    url(r'^autores/$','principal.views.autores'),
    url(r'^buscar/$','principal.views.buscarEvento'),
    url(r'^artistas/$','principal.views.artistas'),
    url(r'^addevento/$','principal.views.nuevoevento'),
    url(r'^perfil_eventos/(?P<id_evento>\d+)$','principal.views.detalle_evento'),
    url(r'^perfil_temporadas/(?P<id_temporada>\d+)$','principal.views.detalle_temporada'),
    url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    url(r'^back/', include('grappelli.urls')), # grappelli URLS
    url(r'^admin/', include(admin.site.urls)),
    url(r'^media/(?P<path>.*)$','django.views.static.serve',
        {'document_root':settings.MEDIA_ROOT,}
    ),
    url(r'^contacto/$','principal.views.contacto'),
    url(r'^receta/nueva/$','principal.views.nuevoevento'),

    url(r'^usuario/nuevo$','principal.views.nuevo_usuario'),
    url(r'^ingresar/$','principal.views.ingresar'),
    url(r'^privado/$','principal.views.privado'),
    url(r'^cerrar/$', 'principal.views.cerrar'),


)
    
asked by Roly89 02.03.2018 в 16:16
source

1 answer

0

The problem is that in your route you are setting the character '/' at the end, as it is a regular expression django expects the path to completely match the expression. But on the route you are placing enter without the slash at the end. change the regular expression to:

'^ enter' simply or '^ enter /?' where the '?' indicates that the preceding character may or may not exist in the evaluated chain.

    
answered by 24.03.2018 в 04:14