Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

151
Views
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)
over 4 years ago · Santiago Trujillo
1 answers
Answer question

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.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!