Gae58
April 30, 2024, 8:49am
1
static
Hi, I have the principlae app folder called Pale
in settings section TEMPLATE I have inserted this
'DIRS': [BASE_DIR / "templates"],
and the css file I load them quietly like this
<link rel="stylesheet" href="{% static 'Pale/css/MenuMainFO.css' %}">
I created another app called Users and in the folder Users/static/Users/css
I have the file Users.css
which I load with this code
<link rel="stylesheet" href="{% static 'Users/css/Users.css' %}">
It can’t find it, though.
Should I update the settings file ?
What operating system are you using?
What versions of Django and Python?
Is this happening in your development environment, or in your production environment?
How are you running your project?
Please verify the contents of this static directory. (Show the output of an ls
or dir
command for Users/static/Users/css
.)
Gae58
April 30, 2024, 2:07pm
3
What operating system are you using?
windows i am trying locally
What versions of Django and Python?
Python 3.12.0
Django 5.01
Is this happening in your development environment, or in your production environment?
development
How are you running your project?
Using pycharm and launching runserver with firefox
Please verify the contents of this static directory. (Show the output of an ls
or dir
command for Users/static/Users/css
.)
(venv) PS C:\ProgettiPython\PalestraGes\Utenti\static\Utenti\css> ls
Directory: C:\ProgettiPython\PalestraGes\Utenti\static\Utenti\css
Mode LastWriteTime Length Name
-a---- 29/04/2024 13:12 1291 Utenti.css
And what is the actual content of the template you’re rendering?
(I’m guessing that even though you referenced “Users” in your explanation that your template is actually referencing “Utenti”?)
Gae58
April 30, 2024, 2:58pm
5
content of Utenti.css
/*
=============================================================================================
--- Definizione design UTENTI
============================================================================================= */
.utenteConte {
display: flex;
align-items: center;
justify-content: center;
/*height: 100vh;*/ /* Preferisco non averlo a pagina piena */
}
.utenteForm {
background-color: var(--header-info-bg);
border: 1px solid var(--bianco);
border-radius: 5%;
padding: 2rem;
font-weight: 700;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
/*max-width: fit-content;*/ /* Allarga il contenitore alla scritta + larga */
width: 300px;
margin: 0 auto;
}
.utenteForm input, select, textarea {
width: 100%;
margin-bottom: 10px;
padding: 10px;
padding: 1em;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
border: none;
/*color: white;*/
}
.utenteForm .btn-conferma {
display: block;
width: 100%;
/*padding: 15px;*/
padding: 16px 34px 18px;
font-size: 16px;
font-weight: 500;
color: var(--btn-conferma-fg);
color: var(--bianco);
background: transparent;
background-color: var(--btn-conferma-bg);
border-radius: 5%;
cursor: pointer;
transition: background-color 0.3s ease-in;
}
.utenteForm .btn-conferma:hover {
color: var(--nero-body);
/*background-color: rgb(85, 85, 240);*/
background-color: var(--bianco);
}
.utenteForm .errorlist li {
list-style-type: none;
color: rgb(216, 6, 114);
}
@media screen and (max-width: 600px) {
.utenteForm {
width: 90%;
}
}
In the html when I call it up
<link rel=“stylesheet” href=“{% static ‘Users/css/Users.css’ %}”>
I get the message back that it can’t find the file Users.css
But the file is present
Because according to what you’ve posted here, you don’t have a file named Users.css
. You have a file named Utenti.css
, which is a different name.
Gae58
May 1, 2024, 10:31am
7
Sorry, you are right but in the first step I translated Utenti.css to User.css
In the second answer no
Please clarify. You have posted twice:
And then posted:
Gae58:
(venv) PS C:\ProgettiPython\PalestraGes\Utenti\static\Utenti\css> ls
Directory: C:\ProgettiPython\PalestraGes\Utenti\static\Utenti\css
Mode LastWriteTime Length Name
-a---- 29/04/2024 13:12 1291 Utenti.css
Gae58
May 1, 2024, 1:42pm
9
Gae58:
ss/Users.css’ %}">
The first post refers to loading the css into the html file
The second is what is displayed to me in the terminal
Yes, and they don’t match.
You’re trying to reference a file name that doesn’t appears to exist.
You have not shown that you have a Users/css
directory with a file named Users.css
.
Gae58
May 1, 2024, 3:01pm
11
Excuse me in Italian I have Users.css which corresponds to Users.css in English
I don’t know why but it works now
Thanks for supporting me