Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

119
Vistas
Basic URL Django Issue

This basic url issue is giving me a headache. I have two links I wish to take a fictitious user to: localhost/prediction and localhost/prediction/. The first works, the second doesn't with an error saying that the site doesn't exist. Any clue as to why?

URl Patterns:

urlpatterns = [
    # ex: /prediction/
    url(r'^', views.post_list),
    # ex: /prediction/<number>/
    url(r'^(?P<number>[0-9]+)/$', views.show_body)
]

View:

def show_body(request, number):
    return HttpResponse(number)
about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You should change your pattern from

url(r'^', views.post_list),

to

url(r'^$', views.post_list),

There's no need to add a leading slash, because every URL has that. See the example in the Django docs.

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda