Note that there are some explanatory texts on larger screens.

plurals
  1. POPage not found when passing parameters via URL in Django
    primarykey
    data
    text
    <p>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: <a href="http://127.0.0.1:8000/recipes/search/fish/" rel="nofollow">http://127.0.0.1:8000/recipes/search/fish/</a> for example...</p> <p>Using the URLconf defined in gfp.urls, Django tried these URL patterns, in this order:</p> <pre><code>^recipes/$ ^recipes/category/(?P&lt;category&gt;\d+)/$ ^recipes/search/(?P&lt;term&gt;\d+)/$ ^recipes/view/(?P&lt;slug&gt;\d+)/$ ^admin/ </code></pre> <p>The current URL, recipes/search/fish/, didn't match any of these.</p> <p>For reference here is my URLconf</p> <pre><code>urlpatterns = patterns('', url(r'^recipes/', 'main.views.recipes_all'), url(r'^recipes/category/(?P&lt;category&gt;\d+)/$', 'main.views.recipes_category'), url(r'^recipes/search/(?P&lt;term&gt;\d+)/$', 'main.views.recipes_search'), url(r'^recipes/view/(?P&lt;slug&gt;\d+)/$', 'main.views.recipes_view'), </code></pre> <p>For reference here are the views I am attemping to use at the moment</p> <pre><code>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)) </code></pre> <p>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:</p> <p><a href="https://docs.djangoproject.com/en/1.4/intro/tutorial03/" rel="nofollow">https://docs.djangoproject.com/en/1.4/intro/tutorial03/</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload