37 lines
582 B
Markdown
37 lines
582 B
Markdown
status: #doc
|
|
Tags: #python/django
|
|
links:
|
|
Date: 2024-07-07
|
|
___
|
|
# static files
|
|
|
|
## setup
|
|
for start of project and in simple case do below
|
|
|
|
- make folder `static` inside my_app folder
|
|
- make folder with name of your app (ex:my_app) inside static folder
|
|
- move image ,js,css files there
|
|
|
|
|
|
## images
|
|
|
|
we use static [[templates#tags|tag]] for accessing our files for images we do this in our [[templates]]
|
|
```django
|
|
{% load static %}
|
|
<img src="{% static 'my_app/example.jpg' %}" alt="My image">
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
# References
|
|
https://docs.djangoproject.com/en/5.0/howto/static-files/
|
|
|
|
|