Home > Enterprise >  Browser loads an empy css
Browser loads an empy css

Time:06-10

css located in my_blog/my_blog/blog/static/blog/style.css manage.py in my_blog/my_blog head of html:

{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="{% static 'blog/style.css' %}">
    <title>{% block title%} My blog {% endblock %}</title>
</head>

I'm using pycharm pro. Browser successfully load css file, but it's empty. Why this is happenning?

I don't see css loading in django console log, when pages load. I changed name of css file. And it's loaded, but once.

When I add new rule to it and reload server, browser still get old version of css.

Now it's works fine. Css loaded properly. I didn't change anything, so I don't know what did happen.

CodePudding user response:

Add this to your settings.py:

os.path.join(BASE_DIR, 'static')

Then move your static folder to project's folder - /my_blog/static/blog/style.css instead of the current one.

CodePudding user response:

I don't believe your href is formatted properly

  • Related