Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7894147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:19:11+00:00 2026-06-03T07:19:11+00:00

I suspect it may be something to do with the way I am styling

  • 0

I suspect it may be something to do with the way I am styling my regular expressions, because I get the following output when I try to go to: http://127.0.0.1:8000/recipes/search/fish/ for example…

Using the URLconf defined in gfp.urls, Django tried these URL patterns, in this order:

^recipes/$
^recipes/category/(?P<category>\d+)/$
^recipes/search/(?P<term>\d+)/$
^recipes/view/(?P<slug>\d+)/$
^admin/

The current URL, recipes/search/fish/, didn’t match any of these.

For reference here is my URLconf

urlpatterns = patterns('',
url(r'^recipes/', 'main.views.recipes_all'),
url(r'^recipes/category/(?P<category>\d+)/$', 'main.views.recipes_category'),
url(r'^recipes/search/(?P<term>\d+)/$', 'main.views.recipes_search'),  
url(r'^recipes/view/(?P<slug>\d+)/$', 'main.views.recipes_view'),

For reference here are the views I am attemping to use at the moment

def recipes_all(request):
    return HttpResponse("this is all the recipes")

def recipes_category(request, category):
    return HttpResponse("this is the recipes category % s" % (category))

def recipes_search(request, term):
    return HttpResponse("you are searching % s in the recipes" % (term))

def recipes_view(request, slug):
    return HttpResponse("you are viewing the recipe % s" % (slug))

I suspect it is my regular expression, would anyone be able to explain what is wrong with it please? I have seen /w(?) used on some url regex, but it doesnt go into it in the Django tuorial here:

https://docs.djangoproject.com/en/1.4/intro/tutorial03/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T07:19:12+00:00Added an answer on June 3, 2026 at 7:19 am

    '^recipes/search/(?P<term>\d+)/$' matches /recipes/search/123456/
    while '^recipes/search/(?P<term>[-\w]+)/$' is probably what you need. (Updated with hyphens)

    Take a look at Python re docs to understand what ‘\d’, ‘\w’ and others mean.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following situation in code, which I suspect may be a bit
Does Asp.Net require ActiveX to make Ajax calls? I suspect it does because without
I'm trying to figure out an elegant way to get a date from a
I'm using .Net framework 2.0 to try and do the following: I've an external
I'm suddenly missing the empty class template. I suspect that it is because of
Is there a relatively straightforward way to get the intersection of two DataTables in
I'm using the following code to try to play a sound clip with the
I suspect this applies to general ASP.Net too but I am not sure. If
I suspect that calls from separate threads (>15) are having a negative effect on
I suspect that adding a certain letter/character to the beginning of my text will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.