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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:27:21+00:00 2026-06-08T12:27:21+00:00

I have urls where spaces are replaced with the – character. So I made

  • 0

I have urls where spaces are replaced with the “-” character.
So I made a url regex like this:

url(r'^(?P<item_url>(\w+-?)*)/$', 'detail'),

my view:

def detail(request, item_url):
   i = get_object_or_404(Page, url=item_url,published=True)
   return render_to_response('item/detail.html', {'item':i},
       context_instance=RequestContext(request))

Unfortunately this keeps django extremely busy on urls with more than 20 characters. The process hangs for 20sec – 1 minute and then returns the correct result. Is this based on a wrong regex I’m using?

  • 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-08T12:27:22+00:00Added an answer on June 8, 2026 at 12:27 pm

    Try the following url pattern:

    url(r'^(?P<item_url>[\w-]+)/$', 'detail'),
    

    [\w-]+ will match one or more alphanumeric characters or hyphens.

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

Sidebar

Related Questions

I have urls like this: www.wunderwedding.com/weddingvenues/share-weddingvenue/175/beachclub-all-good www.wunderwedding.com/weddingvenues/share-weddingvenue/2567/castle-rock Since these urls no longer exist, I
I want to have URLs like this: some-company-name-deal-id-6.htm So the rewrite rule should ignore
What I am trying to do is as follows I have urls like this
[NOTE: I'm using ASP.NET MVC2 RC2.] I have URLs like this: /customers/123/orders/456/items/index /customers/123/orders/456/items/789/edit My
It's easier to be told by example. I have URLs like http://domain/product/view/id/ . How
I have URLs which always end on a number, for example: String url =
I'd like to have URLs that are even shorter than /{Controller}/{Action}/{Id}. For example, I'd
So I'd like to have urls on my site like http://foobar.com/hadees that goes to
I have this list of urls: http://test1.google.com/test1/12345http://test2.google.com/test2/12345http://test3.google.com/test4/12345http://test1.google.com/test1/12345http://test1.google.com/test1/12345http://test1.google.com/test1/12345http://test1.google.com/test1/12345http://test1.google.com/test1/12345 It's just an example, I want to
Please deal with this trivial question. I am getting some URLs like SOME_DOMAIN?q\x3dnintendo+mathe\x26um\x3d1\x26ie\x3dUTF-8\x26tbm\x3dshop\x26cid\x3d8123694338777545283\x26sa\x3dX\x26ei\x3dL8cjUJmHO8L30gGa1ICgCw\x26ved\x3d0CI4BEIIIMAk which

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.