In Django settings.py file we have
STATIC_URL = '/static/'
And in each app directory I have static folder for css, js files.
For example:
├── myapp
│ ├── migrations
│ ├── __pycache__
│ ├── static
│ └── templates
When I use {% static "......." %} in *.html file
For example
<link rel="stylesheet" href="{% static "style/fesahat.css" %}" />
<link rel="stylesheet" href="{% static "style/loginStyle.css" %}" />
In output render django creates URL like this:
mysite.com/static/style/fesahat.css
mysite.com/static/style/loginStyle.css
I want to create the URL like this:
mysite.com/myapp/templates/static/style/fesahat.css
mysite.com/myapp/templates/static/style/loginStyle.css
No you don't. Static files are not templates; don't put them there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With