Arquivos estáticos (staticfiles), STATIC_URL, STATICFILES_DIRS e load static

This commit is contained in:
Luiz Otávio
2023-04-21 09:14:54 -03:00
parent 33b24dfe03
commit dc90353228
4 changed files with 12 additions and 1 deletions

View File

@@ -1,9 +1,11 @@
<!DOCTYPE html> {% load static %}<!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title> <title>Document</title>
<link rel="stylesheet" href="{% static 'home/css/blue.css' %}">
<link rel="stylesheet" href="{% static 'global/css/red.css' %}">
</head> </head>
<body> <body>

View File

@@ -0,0 +1,3 @@
body {
background: red;
}

View File

@@ -0,0 +1,3 @@
body {
background: blue;
}

View File

@@ -120,6 +120,9 @@ USE_TZ = True
# https://docs.djangoproject.com/en/4.2/howto/static-files/ # https://docs.djangoproject.com/en/4.2/howto/static-files/
STATIC_URL = 'static/' STATIC_URL = 'static/'
STATICFILES_DIRS = [
BASE_DIR / 'base' / 'static'
]
# Default primary key field type # Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field # https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field