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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:43:18+00:00 2026-05-25T00:43:18+00:00

I’ve found a lot of different examples on how to do this, all slightly

  • 0

I’ve found a lot of different examples on how to do this, all slightly different in what they say to set as the MEDIA_URL, STATIC_URL, MEDIA_ROOT, MEDIA_URL. My project files are structured as follows:

myproject/
    images/ (user-uploaded)
    media/ (empty so far)
    settings.py
    static/
        css/
            styles.css
        fonts/
    templates/
        auth/
            base.html
            login.html
        index.html
    urls.py

And of course there’s app directories in the root folder. For my images to show up on the index template, I did this:

urls.py:

from django.conf import settings

(r'%s(?P<path>.*)' % settings.MEDIA_URL[1:], 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),

settings.py (these were the default):

MEDIA_ROOT = ''

MEDIA_URL = ''

STATIC_ROOT = ''

STATIC_URL = '/static/'

ADMIN_MEDIA_PREFIX = '/static/admin/'

The site I’m making is on the front end just a single page. How do I get the stylesheet to link properly? I’m not really sure what the difference is between all these directory settings or why I would use one over another… or what the best way (if there is one) is to structure the whole thing, with where to put css, javascript, fonts, static images, user-uploaded images, etc.

  • 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-25T00:43:18+00:00Added an answer on May 25, 2026 at 12:43 am

    Media is for user uploaded files, static – for your CSS and and other files, so you must create there directories for your static files like js and css.

    You’ve done right all things, because something like this in official documentation in Django. I’ll leave how my friend told me to do, to server static files in few machines:

    # settings.py
    PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
    sys.path.insert(0, os.path.join(PROJECT_DIR, 'models'))
    PROJECT_URL = 'http://127.0.0.1:8000'
    
    MEDIA_ROOT = os.path.join(PROJECT_DIR, 'media')
    
    MEDIA_URL = PROJECT_URL + '/media/'
    
    STATIC_ROOT = os.path.join(PROJECT_DIR, 'static')
    
    STATIC_URL = PROJECT_URL + '/static/'
    
    ADMIN_MEDIA_PREFIX = PROJECT_URL + '/static/admin/'
    
    # Additional locations of static files
    STATICFILES_DIRS = (
        os.path.join(PROJECT_DIR, 'static'),
        os.path.join(PROJECT_DIR, 'media'),
    )
    # urls.py
    urlpatterns += patterns('',
            (r'^media/(?P<path>.*)$', 'django.views.static.serve',{'document_root': settings.MEDIA_ROOT}),
            (r'^static/(?P<path>.*)$', 'django.views.static.serve',{'document_root': settings.STATIC_ROOT}),
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I am using Paperclip to handle profile photo uploads in my app. They upload

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.