Following this structure:
gallito (Django project folder)
|_gallito
|_main_app
|_static
|_main_app
|_style.css
|_static
|_style2.css
|_templates (new)
|_registration
|_login.html
|_base.html
I need/want to have a base template in project root template folder, that extends to my html files inside my main_app (and other apps there will be in the future).
'base.html' extends correclty but it has problems reading the css file inside the static folder in project root: 'style2.css'
In my base.html file inside project root directory static templates folder, I've:
Using this and calling the style sheet from main_app I get my site working:
<link href="{% static 'main_app/style.css' %}" rel="stylesheet">
But if I want to call the style sheet from project root static folder, It wont work:
<link href="{% static 'style2.css' %}" rel="stylesheet">
Why?
I've this in my project settings:
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/
STATIC_URL = '/static/'
I've read that I also need a STATICFILES_DIRS variable to point to my static files dirs. Any pointer on this?
STATICFILES_DIRS
base.html from root:
{% load staticfiles %}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../../../favicon.ico">
<title>Jumbotron Template for Bootstrap</title>
<!-- Bootstrap core CSS -->
<link href="../../dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="jumbotron.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="signin.css" rel="stylesheet">
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet">
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" rel="stylesheet">
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.bundle.min.js" rel="stylesheet">
<link href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" rel="stylesheet"/>
<link href="{% static 'main_app/style.css' %}" rel="stylesheet">
<!--<link href="{% static 'style2.css' %}" rel="stylesheet">-->
</head>