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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:49:58+00:00 2026-05-26T19:49:58+00:00

# urls.py site_media = os.path.join(os.path.dirname(__file__), ‘site_media’ ) urlpatterns = patterns(”, (r’^site_media/(?P<path>.*)$’, ‘django.views.static.serve’, {‘document_root’: site_media}),

  • 0
# urls.py
site_media = os.path.join(os.path.dirname(__file__), 'site_media'
)

urlpatterns = patterns('',
     (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', 
                                     {'document_root': site_media}),
)

I have problems to understand the meaning of the expression used in above statement.

'^site_media/(?P<path>.*)$'

What does it really mean?

Thank you

// ========== Updated based on comments ==============

Reference: Name Groups.

In Python regular expressions, the syntax for named regular-expression
groups is (?P<name>pattern), where name is the name of the group and
pattern is some pattern to match.

Comparison:

Method 1>

(r'^articles/(?P<year>\d{4})/(?P<month>\d{2})/$', 'news.views.month_archive'),

A request to /articles/2005/03/ would call the function

news.views.month_archive(request, year='2005', month='03'),

Method 2>

(r'^articles/(\d{4})/(\d{2})/$', 'news.views.month_archive'),

A request to /articles/2005/03/ would call the function

news.views.month_archive(request, '2005', '03').

  • 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-26T19:49:59+00:00Added an answer on May 26, 2026 at 7:49 pm

    urls are pretty well explained in the docs

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

Sidebar

Related Questions

I am using imagefield to render images. These are the urls; (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root':
I have setup the following in my urls.py: (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}) and my
in my settings.py I have the following: PROJECT_DIR = os.path.dirname(os.path.realpath(__file__)) MEDIA_ROOT = os.path.join(PROJECT_DIR,'templates') MEDIA_URL
In Django, I have images stored in site_media like this : /site_media/somepath/image.jpg The urls.py
My Django urls.py has: from django.conf.urls.defaults import patterns, include, url import admin import settings
Am working with django 1.3 and doing some template inheritance. My /static/ settings path
from django.conf.urls.defaults import * from django.conf import settings from Website.Blog.models import Post # Uncomment
I have tabs that calls via javascript urls of django to complete the container
I have the following code in the urls.py in mysite project. /mysite/urls.py from django.conf.urls.defaults
I'd like to love Django, but this business of static and media files in

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.