problem with admin part of django

Hello django developer friends, I have a problem with the django administration site, indeed I deployed the application locally which apparently runs well, but when I go to the django administration site the css of django-admin does not apply on the site; therefore the formatting of the page is not pleasant. can you help me or offer me a solution? thank you.

Please provide all the relevant details about your deployment environment - what your settings are for static files, what the environment is that you’re deploying to, what steps you followed to do the deployment, and anything else that may be relevant to your situation.

thank you very much, in fact I am using windows server 2012 R and I used the IIS internet services manager for the deployment of with sound the CGI and I added a virtual directory for my static file in other words I added the link of my static file.

That is still just a general description of what you’ve done.

You need to provide all the details of the exact steps you took - if you followed information from a blog post or other documentation site, that would be sufficient. You probably also need to include the actual settings regarding static files in your file along with sufficient information about the directory structure of your deployment.

The more information you provide, the better chance we have of providing assistance.

ok, indeed my own static file is in directory: C: \ inetpu \ wwwroot \ static which I have included in my virtual directory and now and the static file of the administration site is in C: \ users \ administrator \ python39 \ lib \ site-packages \ django \ contrib \ admin \ static \ admin

Hi yaokouadio,

Can you provide the settings as they are defined in the file? It’s easier for us to understand the exact configuration of your application if you share the exact settings and values rather than descriptions of what the settings represent.

Additionally, did you run python collectstatic after deploying?

here is what is in my

Django settings for apprecu project.

Generated by 'django-admin startproject' using Django 3.2.

For more information on this file, see

For the full list of settings and their values, see

from pathlib import Path
import  os
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

# Quick-start development settings - unsuitable for production
# See

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-)t%0nj91d-r^pmty&*0qz5@dp%xi%7!h%^tz@0f*cx#i*t@1yd'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True


# Application definition



ROOT_URLCONF = 'apprecu.urls'

        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR,'templates')],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [

WSGI_APPLICATION = 'apprecu.wsgi.application'

# Database

'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'myd',
        'USER': 'rom',
        'PASSWORD': '5877',
        'HOST': 'localhost',
        'PORT': '5432',

# Password validation

        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',

# Internationalization



USE_I18N = True

USE_L10N = True

USE_TZ = True

# Static files (CSS, JavaScript, Images)

STATIC_URL = '/static/'

# Default primary key field type

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

Thank you, did you run python collectstatic after deploying?

yes i did that the python collectstatic

in reality I don’t know where the problem comes from

or maybe I ran the collectstatic python in the wrong place

What is the setup of this environment? (Heroku, server with nginx/apache, etc). It may also be helpful to re-review this part of the docs and identify any areas that you’re unsure about.

thank you very much, the deployment is done locally on windows server 2012R with the IIS

I do not see a STATIC_ROOT setting in your settings file. Review Deploying static files | Django documentation | Django.

1 Like

ok the static_root is normally at what level please

It’s wherever you want static files to be placed to be served by your web server. It should be outside your projects directory structure.

If this directory:

is where you want to serve static files from, then that would be the setting for STATIC_ROOT.

(That’s assuming your IIS configuration has /static/ mapped to that directory, based upon your STATIC_URL setting.)

thank you I will take notice and get back to you after thank you.

in fact it is the css of my django admin site which is not running. So it’s with the admin site that is causing me problem

Check the network tab in your browser’s developer tools - my guess is that your browser will report that you’re getting a 404 when trying to retrieve those CSS files. You can also check your IIS logs to see what response is being provided for those requests.
If you are getting 404s, then yes, your issue is most likely being caused by the static files not being copied to the right target directory.

ok thank you very much