Hi there I'm extremely new to programming/python/django in general and I'm following the django for beginners book and the part where we add in CSS has got me super confused because I'm getting this error "GET /static/css/base.css HTTP/1.1" 404 1660. I've copied the code from the book 1 to 1 and can't get it to work.
Here's the relevant settings.py
STATIC_URL = '/static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
Here's the base.html I'm adding the css to
{% load static %}
<html>
<head>
<title>Django blog</title>
<link href="{% static 'css/base.css' %}" rel="stylesheet">
</head>
...
And here's the directory info I saw people asking about this in other questions
C:.
├───blog
│ └───migrations
├───blog_project
├───static
│ └───css
└───templates
Try this:
Move the static folder from the project root into the particular App directory. Do that for all the apps you create as Django uses django.contrib.staticfiles which takes care of all static files in your project. As referenced here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With