Add Static File In Django

[Solved] Add Static File In Django | Python Frameworks Django - Code Explorer | www.yomemimo.com
Question : how to add static files in django

Answered by : ashamed-anaconda-k9v88r1x3t1w

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATICFILES_DIRS = [ BASE_DIR / 'static'
]

Source : | Last Update : Sun, 23 Jan 22

Question : add static file in django

Answered by : combative-curlew-51dvmrxoaupz

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATICFILES_DIRS = [ BASE_DIR / 'static'
]
# add this code in settings.py

Source : | Last Update : Wed, 11 May 22

Question : load static files in Django

Answered by : enthusiastic-emu-vueg23k662b8

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

Source : https://docs.djangoproject.com/en/4.0/howto/static-files/ | Last Update : Thu, 26 May 22

Question : add static file in django

Answered by : plain-pheasant-tvfxdqk4u875

STATICFILES_DIRS = [ BASE_DIR / "static", '/var/www/static/',
]

Source : https://docs.djangoproject.com/en/3.1/howto/static-files/ | Last Update : Wed, 02 Dec 20

Question : adding static file and its usage in Django

Answered by : panicky-pollan-7oyzuz07llru

STATICFILES_DIRS = [ BASE_DIR / "static", '/var/www/static/',
]
{% load static %}
<img src="{% static 'my_app/example.jpg' %}" alt="My image">

Source : | Last Update : Wed, 04 Aug 21

Question : How to Add static files in Django template

Answered by : godswill-ohiole-agangan

<!-- 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">

Source : | Last Update : Mon, 12 Sep 22

Question : Configuring static files in Django

Answered by : godswill-ohiole-agangan

# 1. Make sure that django.contrib.staticfiles is included in your
# INSTALLED_APPS.
# 2. In your settings file, define STATIC_URL, for example:
STATIC_URL = '/static/'

Source : | Last Update : Mon, 12 Sep 22

Answers related to add static file in django

Code Explorer Popular Question For Python Frameworks Django