CSS won't load

Hi,

I really need help making css styles load in my page. I have carefully followed the Django Managing Static Files documentation and have done every other things listed here.

The css don’t load on the pages, and the admin area don’t load css too. I am currently working locally, so this is a development server.

Here’s my Code for my base.html
{% load static %}

<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="{% static 'blog/main.css' %}">
{% if title %}
	<title>Labari News - {{ title }}</title>
{% else %}
	<title>Labari News</title>
{% endif %}
<title></title>

Here’s my code for home.html
{% extends “blog/base.html” %}
{% block content%}
{% for post in posts %}

{{ post.title }}


By {{ post.author }} on {{post.date_posted }}


{{ post.content }}


{% endfor %}
{% endblock content%}

Here’s settings.py #Static Files area
STATIC_URL = ‘/static/’

I also attached screenshot of how the admin area loads.

Hi!

Did you follow the debug or production version for static files? If the debug one then you need the special url paths and if the production one then you need to have STATIC_ROOT path in your settings.py that points to the static directory where the files will be collected with collectstatic command.

Hi nemecek_f,

Thank you for your help.

I was able to solved the problem by adding

import mimetypes
mimetypes.add_type("text/css", ".css", True)

to the settings.py file and it solved the problem.

Thank you once more for your help.