Im making a 'learning website' along with the treehouse course and when I run my website server the GET for the CSS returns a 404 error, below I will provide the details I think will help you help me. Thank you for any help this is annoying for trying to learn Django. Ive looked everywhere and cannot find something to help me, I will happily give more info in the comments!
Here is my file structure:
~/PycharmProjects/learning_site
|--.idea
|--assets
| |--css
| |--layout.css
|--courses
|--learning_site
|--templates
db.sqlite2
manage.py
This is my static variables defined in the settings.py file.
STATIC_URL = '/static/'
STATICFIILES_DIRS = (
os.path.join(BASE_DIR, 'assets'),
)
This is my layout.html template where the css is called.
{% load static %}<!doctype html>
<html>
<head>
<title> {% block title %} {% endblock %}</title>
<link rel = "stylesheet" href="{% static '/css/layout.css' %}"}>
</head>
<body>
<div class="site-container">
{% block content %}{% endblock content %}
</div>
</body>
</html>
This is the homepage where the CSS would be displayed.
{% extends "layout.html" %}
{% block title %} Well hello there! {% endblock %}
{% block content %}
<h1>Welcome!</h1>
{% endblock %}
<a href="127.0.0.1/courses/"> Courses offered </a>