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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:31:10+00:00 2026-06-12T14:31:10+00:00

So i have a main urls.py that looks like this: urlpatterns = patterns(”, (r’^users/(?P<username>.*)/’,

  • 0

So i have a main urls.py that looks like this:

    urlpatterns = patterns('',
(r'^users/(?P<username>.*)/', include('app.urls')), 
url(r'^users/(?P<username>.*)$',direct_to_template,{'template':'accounts/profile.html'}, name='profile'),)

and a app.urls.py

urlpatterns = patterns('',url(r'^app/create/$', create_city ,name='create_city'),)

my problem is, when i localhost:8000/users/michael/app/create/ it doesn’t call my view. I have tried changing the order of the urls with no luck so i believe my problem is with the regular expressions but with no idea on what to change, anyone?

  • 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-12T14:31:11+00:00Added an answer on June 12, 2026 at 2:31 pm

    The named group (?P<username>.*) will match any characters, zero or more times. in your username, including forward slashes.

    In url patterns, it would be more common to use (?P<username>[-\w]+). This would match at least one character from the set of lowercase a-z, uppercase A-Z, digits 0-9 hyphens and underscores.

    I also recommend that you add a trailing slash to your pattern for your profile view.

    Putting it all together, I suggest you use the following as a starting point for your urls.py:

    urlpatterns = patterns('',
       url(r'^users/(?P<username>[-\w]+)/$',direct_to_template, {'template':'accounts/profile.html'}, name='profile'), 
       (r'^users/(?P<username>[-\w]+)/', include('app.urls')), 
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 4 URLs that I would like to redirect to my main page.
I have web software where I need to have URLs like this http://site.com/page/var1/val1/var2//var3/val3 Then
I currently have a login page that sends all authenticated users to a main
I have paginated URLs that look like http://www.domain.com/tag/apple/page/1/ If a URL such as http://www.domain.com/tag/apple/page/*2/
I have main table called 'Employee' and another slave table called 'EmployeeTypes' that has
Splash I have main activity UI startup operations that take between 5-10 seconds (that
I have a main-section div that is set to inherit it's height from its'
i have problem with django's named urls which is included with include keyword. In
I have five SWF files that are loaded into a main SWF. All five
I have a UITableView that has photos, i get these photos from URLs and

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.