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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:27:17+00:00 2026-05-26T06:27:17+00:00

I set up a simple project and everything was working fine up to a

  • 0

I set up a simple project and everything was working fine up to a certain point. I was adding stuff to the project, paths to static dirs, etc, and then suddenly I realised that admin media stopped being served, no css, no images.

Viewing the source of the page reveals this:

link rel="stylesheet" type="text/css" href="/static/admin/css/base.css"

Which is correct and the same path works with any newly created Django project.

Basically I would like to somehow reenable that the admin media is being served from default location.

This is the settings.py but frankly I wasn’t changing it much from the point when it stopped working.

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = os.path.join(PROJECT_ROOT, "site_media", "media")

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
MEDIA_URL = "/site_media/media/"

# Absolute path to the directory that holds static files like app media.
# Example: "/home/media/media.lawrence.com/apps/"
STATIC_ROOT = os.path.join(PROJECT_ROOT, "site_media", "static1")

# URL that handles the static files like app media.
# Example: "http://media.lawrence.com"
STATIC_URL = "/site_media/"

# Additional directories which hold static files
STATICFILES_DIRS = [
    os.path.join(PROJECT_ROOT, "site_media"),
    os.path.join(PROJECT_ROOT, "site_media", "static"),
    os.path.join(PROJECT_ROOT, "site_media", "media"),
]

# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/static/admin/'

# Make this unique, and don't share it with anybody.
SECRET_KEY = '__@9nw29=7gbj8xb5z*u6cew3x8m(&_v&jlp16!^bnpe+6@w0#'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
#     'django.template.loaders.eggs.Loader',
)

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
)

ROOT_URLCONF = 'wizs.urls'

TEMPLATE_DIRS = (
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    os.path.join(PROJECT_ROOT, "templates"),
)


TEMPLATE_CONTEXT_PROCESSORS = [
    "django.core.context_processors.auth",
    "django.core.context_processors.debug",
    "django.core.context_processors.i18n",
    "django.core.context_processors.media",
    "django.core.context_processors.request",
    "django.contrib.messages.context_processors.messages",
    'django.core.context_processors.static',
]

UPDATE

Seems that it came down to juggling these two properties:

1) Now I see admin media but NOT the media (e.g. uploaded images)

STATIC_URL = "/site_media/static/"
ADMIN_MEDIA_PREFIX = '/site_media/static/admin/'

2) Now I see uploaded media files but NOT the admin media

STATIC_URL = "/site_media/"
ADMIN_MEDIA_PREFIX = '/site_media/static/admin/'
  • 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-26T06:27:18+00:00Added an answer on May 26, 2026 at 6:27 am

    It looks like STATIC_URL should be “/site_media/static1/” and ADMIN_MEDIA_PREFIX should be “/site_media/static1/admin/”

    Some other suggestions:

    1. Don’t compile your MEDIA_ROOT into your STATIC_ROOT, so remove os.path.join(PROJECT_ROOT, "site_media", "media"),
    2. Your local static files should also not be in site_media. so remove os.path.join(PROJECT_ROOT, "site_media", "static"), and change it to os.path.join(PROJECT_ROOT, "static"), and move that directory there.
    3. You should the clear out site_media locally, and only have it filled on the server. (or, of course with any media that you upload locally). But you don’t need to run collectstatic locally at all.
    4. If/Once you do those things, you can change “static1” back to static, and then serve the entire /site_media/ folder via nginx, and then you won’t have any duplicates in that folder.

    Good luck.

    Here Are my settings:

    # settings.py
    MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'site_media', 'media')
    MEDIA_URL = '/site_media/media/'
    
    STATIC_ROOT = os.path.join(PROJECT_ROOT, 'site_media', 'static')
    STATIC_URL = '/site_media/static/'
    
    ADMIN_MEDIA_PREFIX = '/site_media/static/admin/'
    
    STATICFILES_DIRS = (
        os.path.join(PROJECT_ROOT, 'static'),
    )
    
    STATICFILES_FINDERS = (
        'django.contrib.staticfiles.finders.FileSystemFinder',
        'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    )
    
    # urls.py
    from django.conf import settings
    
    urlpatterns += patterns('',
        url(r'^site_media/static/(?P<path>.*)$', 'django.contrib.staticfiles.views.serve'),
        url(r'^site_media/media/(?P<path>.*)$', 'django.views.static.serve', {
            'document_root': settings.MEDIA_ROOT,
        })
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

just set up a simple project to test the functionality of the maven exec
I have been working on a demo project all day and everything went just
I have a fairly simple set of functionality for which I have multiple implementations,
Given a simple data set, I would like to be able to calculate a
I've set up a simple jQueryUI progressbar: <script type=text/javascript> $(function() { $(#progressbar).progressbar({ value: 35
I am trying to set up a simple transaction for my Linq-to-Sql actions against
I'm trying to set up a simple server side RSA encryption of a small
I wanted to set up a simple data communication between two C# applications, and
I'm trying to set together a simple TextBox with some watermark text in the
I'm trying to set up a simple SQLite database in Android, handling the schema

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.