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 802373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:35:27+00:00 2026-05-14T23:35:27+00:00

Error can be seen here: http://djaffry.selfip.com:8080/ I want the index page to accept parameters,

  • 0

Error can be seen here: http://djaffry.selfip.com:8080/

I want the index page to accept parameters, whether it be

mysite.com/search/param_here

or

mysite.com/?search=param_here

I have this in my URL patterns, but I can’t get it to work. Any suggestions?

urlpatterns = patterns('',
        (r'^$/(?P<tag>\w+)', 'twingle.search.views.index'),
    )
  • 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-05-14T23:35:28+00:00Added an answer on May 14, 2026 at 11:35 pm

    First of all your regular expression in url pattern is wrong.

    r'^$/(?P<tag>\w+)'
    

    It says to match everything from

    • ^ the beginning of line
    • $ to the end of line
    • having pattern named tag which is composed of words and digits after the line end

    Usually after the one line ends comes another line or EOF not content (unless you use multiline regexp and you don’t need those here).

    Line end should be after the tag:

    r'^/(?P<tag>\w+)$'
    

    Using a query string

    Query strings are not parsed by url reslover.

    Thus, if you have url in format:

    http://mysite.com/?query=param_here
    

    will match:

    (r'^$', 'twingle.search.views.index')
    

    In this case you can access query string in view like so:

    request.GET.get('query', '')
    

    Without a query string

    mysite.com/search/param_here 
    

    will match:

    (r'^search/(?P<query>\w+)$', 'twingle.search.views.index'),
    

    Where everything that matches \w (you should change this to suite your needs) will be passed along with request to index view function as argument named query.

    Both

    You can use both url patterns like so:

    urlpatterns = patterns('twingle.search.views',
       url(r'^$', 'index'),
       url(r'^search/(?P<query>\w+)$', 'index'),
    )
    

    In this example the view would look something like this:

    def index(request, query=None)
        if not query:
           query = request.GET.get('query', '')
        # do stuff with `query` string
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the exact code seen here: http://gazpo.com/downloads/tutorials/html5/contentEditable/ As you can see, when
I have a pagination script, which can be seen here: http://www.automotori6282.tk/phpsandbox/ This is the
I have three files: Main, slist.h and slist.cpp can be seen at http://forums.devarticles.com/c-c-help-52/confused-why-i-am-getting-c2143-and-c1010-error-259574.html I'm
According to the documentation located here: http://archive.plugins.jquery.com/project/query-object In order to customize $.query 's parameters
Error: 'WithEvents' variables can only be typed as classes, interfaces or type parameters with
I've seen related posts on other forums about this (see: http://www.mrexcel.com/forum/showthread.php?t=372534 ), but I've
I'm been trying to wrap javascript try/catch as seen on http://pastebin.com/f579d999d It works well,
I've seen many similar errors, but I can't see a solution that applies to
I get this error: Can't locate Foo.pm in @INC Is there an easier way
I can't convert ds.Tables[1].Rows[0].ToString() to an int. ds.Tables[1].Rows[0] = 100; Gives an error can't

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.