Hi everyone,
I’m trying to add some .css styling to my files but the issue is when I use the {% load staticfiles %}
it gives me an error that says the following:
This is what my directory looks like:
https://ibb.co/XzS8MGv
and this is my current .setting file:
https://ibb.co/Xbd48nn
Debug is set to True.
What is the issue here?
I have but it doesn’t seem to solve the issue. The syntax is identical to what is available on the docs.
Does anyone know exactly what the problem is why it is not finding the static .css file?
What you show in the image is not what’s in the docs.
I’ve changed the doctor.html file to the following:
<head>
{% load static %}
<link rel = "stylesheet" href = "{% static 'css/style.css' %}" type = "text/css" media = "screen">
</head>
While the server doesn’t break anymore I’m not seeing the actual changes on the webpage.
I do see a GET request has been fullfilled
[05/Dec/2021 07:41:02] "GET /static/css/style.css HTTP/1.1" 304 0
and this is my current configuration with .setting. Everything else remains the same.
STATIC_URL = '/static/'
STATICFILES_DIR = [
BASE_DIR / 'static',
]
Ok, this is a different situation.
The HTTP 304 response code you’re seeing in your log is the key here - basically it’s saying that your browser is caching that file and not requesting a new version from the server.
See both replies at Changes in CSS (Style sheet) not reflecting in the Page
Hi @KenWhitesell I have the same issue as above, I’m getting 404 on static files.
Thanks for your help.
Here is my Project structure:
Hi @Fantania, I’ll be more than happy to assist you, but I will ask that you open a new topic for this. And when you do so, please include the following additional information:
- What server are you using here? (runserver? Werkzeug? gunincorn? etc)
- In your settings.py file, what are your settings for:
- DEBUG
- STATICFILES_DIRS
- INSTALLED_APPS
- What are the contents of your root urls.py file? (That’s the urls.py file pointed to by your ROOT_URLCONF setting)
Side note: When you’re posting log data like above, or code, enclose the code between lines of three backtick - ` characters. This means you’ll have a line of ```, then your code, then another line of ```. This forces the forum software to keep that code properly formatted. If it’s just a single line or portion of a line, use a single backtick - ` before and after the text on the same line.
Please do not post images of code or logfile output.