I cannot get the CSS to appear when I refresh the page nor when I turn the server off and then restart it.
{% load staticfiles %}
<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<meta charset="utf-8">
<meta name='viewpoint' content='width-device-width, initial-scale-1.0'>
<meta http-equix='X-UA-Compatible' content='ie-edge'>
<link rel="stylesheet" type='text/css' href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-rc.2/css/materialize.min.css"/>
<link ref="stylesheet" type='text/css' href="{% static 'css/styles.css' %}" />
My settings.py file has STATIC_URL = '/static/'
I'm not sure what else it could be. I've attempted several other stackoverflow questions but I'm out of ideas.
Any help is appreciated.
in setting.py file your set DEBUG=True
, please update url.py file root (url.py project)
from django.conf.urls import url
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
#url pattern.....
]
if settings.DEBUG:
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
and than if DEBUG=False
ALLOWED_HOSTS=['your_host']
, please running command ./manage.py collectstatic from the terminal