Currently, I am in the process of developing a website using Django. However, I have encountered an issue where my CSS file does not seem to be applying any styling to the page. I have double-checked that my STATIC_URL is properly defined but unfortunately, the problem persists.
In my settings.py file:
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
Within my blog app directory, I have created a static folder as follows:
blog
|
static
|
css
|
blog.css
This is a snippet from my HTML document:
{% load staticfiles %}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Medicare Supplemental info</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
<!-- The CSS file import location -->
<link rel="stylesheet" href="{% static 'css/blog.css' %}">
</head>
I have verified that the necessary app is installed within the settings.py under INSTALLED_APPS:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'blog',
]
Furthermore, I attempted altering the way static files are loaded from:
{% load staticfiles %}
to:
{% load static %}
Unfortunately, this change did not resolve the issue. Can anyone provide some guidance on what might be causing the problem?