Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

load static files in Django

{% load static %}
<img src="{% static 'my_app/example.jpg' %}" alt="My image">
Comment

Static Assets in Django

STATIC_URL = '/static/'
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'static'),
]
STATIC_ROOT = os.path.join(BASE_DIR, 'static_root')
 
 
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
Comment

how to use static files in django

#In your templates, use the static template tag to build the URL for the given relative path using the configured STATICFILES_STORAGE.
{% load static %}
<img src="{% static 'my_app/example.jpg' %}" alt="My image">
Comment

PREVIOUS NEXT
Code Example
Python :: how to use if else to prove a variable even or odd in python 
Python :: with python how to check alomost similar words 
Python :: dire Bonjour en python 
Python :: pandas groupby get all but first row 
Python :: check if user has manage messages discord.py 
Python :: Make A Snake Game Using Python and Pygame 
Python :: how to convert string to date object in python 
Python :: pandas replace nan 
Python :: convert from epoch to utc python 
Python :: getting image from path python 
Python :: get all count rows pandas 
Python :: how to find mean of one column based on another column in python 
Python :: from PyQt5 import Qsci 
Python :: python read live radio 
Python :: audacity 
Python :: python list distinct 
Python :: django wait for database 
Python :: extract link from text python 
Python :: encrypt and decrypt python 
Python :: make pandas df from np array 
Python :: CUDA error: device-side assert triggered 
Python :: find absolut vale in python 
Python :: youtube-dl python download to specific folder 
Python :: pandas load dataframe without header 
Python :: read csv without index 
Python :: first row as column df 
Python :: python print without leading whitespace 
Python :: python how to add picture to label with tkinter 
Python :: selenium python 
Python :: pickle.load python 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =