My Django web application dont load styles files when in production

My project in Django GitHub - alex-martins2305/ToDo4 works very fine in production, bootstrap, css, everything loads perfect. But in deploy to render.com the css file dont load.

I already checked:

In github the files are avaliable in static/css/styles.css;
run collectstatic;
cleaned browser data;
tryed in mozzila and chrome (desktop and mobile);

In chrome i can see in inspection/network the reason to not apply the style file: Refused to apply style from ‘’ because its MIME type (‘text/html’) is not a supported stylesheet MIME type, and strict MIME checking is enabled.

Hey,

You’re maybe encountering an error because the MIME type of the CSS file is incorrect. It should be set as text/css. Try to edit the settings.py file to include:

STATIC_URL = '/static/'STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'

Run the following command to collect your static files:

python manage.py collectstatic

If the issue continues, clear your browser’s cache and cookies.

Let me know it that helped.

Jérémy.
Render Support, UTC+3

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.