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

  • Home
  • SEARCH
  • 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 815885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:45:01+00:00 2026-05-15T01:45:01+00:00

I have the following code in the urls.py in mysite project. /mysite/urls.py from django.conf.urls.defaults

  • 0

I have the following code in the urls.py in mysite project.

/mysite/urls.py

from django.conf.urls.defaults import *
urlpatterns = patterns('',
    (r'^gallery/$', include('mysite.gallery.urls')),
)

This results in a 404 page when I try to access a url set in gallery/urls.py.

/mysite/gallery/urls.py

from django.conf.urls.defaults import *
urlpatterns = patterns('',  
    (r'^gallery/browse/$', 'mysite.gallery.views.browse'),
    (r'^gallery/photo/$', 'mysite.gallery.views.photo'),
)

404 error

Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:
^gallery/$
The current URL, gallery/browse/, didn't match any of these.

Also, the site is hosted on a media temple (dv) server and using mod_wsgi

  • 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-15T01:45:02+00:00Added an answer on May 15, 2026 at 1:45 am

    Remove the $ from the regex of main urls.py

    urlpatterns = patterns('',
        (r'^gallery/', include('mysite.gallery.urls')),
    )
    

    You don’t need gallery in the included Urlconf.

    urlpatterns = patterns('',  
        (r'^browse/$', 'mysite.gallery.views.browse'),
        (r'^photo/$', 'mysite.gallery.views.photo'),
    )
    

    Read the django docs for more information

    Note that the regular expressions in this example don’t have a $ (end-of-string match character) but do include a trailing slash. Whenever Django encounters include(), it chops off whatever part of the URL matched up to that point and sends the remaining string to the included URLconf for further processing.

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

Sidebar

Related Questions

i have the following code that generate some images with urls associated from database:
http://code.google.com/p/django-threadedcomments/,I have integrated the the following Blog APP with my site.In the URLs.py i
I have the following code that extracts urls from a given page using jsoup.
I have following code for loading image from url in xml parsing endElement method
I have following code that I am compiling in a .NET 4.0 project namespace
I have the following code snippet from a HTML file: <div id=rwImages_hidden style=display:none;> <img
I have the following code: urls <- c( xxxxx, http://stat.ethz.ch/R-manual/R-devel/library/base/html/connections.html, http://en.wikipedia.org/wiki/Xz ) readUrl <-
In Django, is it not possible to have multiple views imports from the urls.py?
I have the following code that is used to turn http URLs in text
I have the following code that grabs youtube's video id from the old share

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.