MIME type ('text/html') is not a supported stylesheet MIME type (is not executable)

Hi, guys! I downloaded the project from Github and faced the problem, that my styles, scripts, images aren’t applied. I get errors of the following kind:

Refused to apply style from '<URL>' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
Refused to execute script from 'http://127.0.0.1:8000/static/assets/vendor/chart.js/chart.umd.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

Structure of the project:

STATIC_URL setting:

STATIC_URL = '/static/'

example of dynamic links in base.html:

<!-- Vendor CSS Files -->
  <link href="{% static 'assets/vendor/bootstrap/css/bootstrap.min.css' %}" rel="stylesheet">
  <link href="{% static 'assets/vendor/bootstrap-icons/bootstrap-icons.css' %}" rel="stylesheet">
  <link href="{% static 'assets/vendor/boxicons/css/boxicons.min.css' %}" rel="stylesheet">
  <link href="{% static 'assets/vendor/quill/quill.snow.css' %}" rel="stylesheet">
  <link href="{% static 'assets/vendor/quill/quill.bubble.css' %}" rel="stylesheet">
  <link href="{% static 'assets/vendor/remixicon/remixicon.css' %}" rel="stylesheet">
  <link href="{% static 'assets/vendor/simple-datatables/style.css' %}" rel="stylesheet">

  <!-- Template Main CSS File -->
  <link href="{% static 'assets/css/style.css' %}" rel="stylesheet">
  <link href="{% static 'assets/css/dark-mode.css' %}" rel="stylesheet">

I would be very grateful if you can help solve the problem :folded_hands:

Try going to that url in your browser. I’m going to bet it’s a 404 page.

I’m going to just guess you should install whitenoise.

yeah, i have 404 error..

I tried to install whitenoise and also specified it in settings.py in MIDDLEWARE 'whitenoise.middleware.WhiteNoiseMiddleware'

Unfortunately, no positive results, still getting the error “Not found” (404).

Try removing the trailing slash so that you have:

STATIC_URL = “static/”

problem not solved (

I had a similar issue a few days ago and it was related to my JS files.

Check your chart.umd.js file because I think something is wrong in that file.

You can also share it and I’ll take a look

here is the link to the chart.umd.js
thansk so much

Please update the question and add the code in .

i am not able to add the code in it, because body is limited to 32000 characters :upside_down_face: My chart.umd.js has 207000…

Let’s take a step back for a moment and check a couple of fundamentals.

Is this your development environment using runserver, or your production environment using something like gunicorn or uwsgi?

Either way, your logs (or console in the case of runsever) should show the 404 codes along with the URL(s) being requested.

Please post all of the URLs being requested that are resulting in a 404.

From your settings.py file, please post the following settings:

  • INSTALLED_APPS
  • MIDDLEWARE
  • DEBUG
  • STATICFILES_DIRS

Yes, it’s my development environment using runserver.

  1. started my server:

  2. opened http://127.0.0.1:8000/, so my login page opened:


  3. Logged in after entering username and password, base page opened:


  4. The same problems occur, when i visit all other pages of the application.
    dashboard:


    inventory:

    create new item:

    and so on..

From settings.py file:

INSTALLED_APPS = [
    'myapp',
    'django_celery_beat',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]
MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.locale.LocaleMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'django_http_referrer_policy.middleware.ReferrerPolicyMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'csp.middleware.CSPMiddleware',
]

regarding DEBUG i have such snippet:

# get debug modus from env
DEBUG = os.environ.get('DEBUG', 'False').lower() in ['true']

I do not have STATICFILES_DIRS

Let my know if if any additional information is needed, thanks.

For testing purposes, set DEBUG = True and try it again.

1 Like

It works, I appreciate it, thanks so much

Just keep in mind that this is for testing and development purposes only. When you’re ready to deploy this to a production environment, you will need to take other steps.

1 Like