1.

How to configure static files?

Answer»

Ensure that django.contrib.staticfiles is added to your INSTALLED_APPS

In your settings file. define STATIC_URL for ex.

STATIC_URL = '/static/'

In your Django templates, use the static template tag to create the URL for the GIVEN relative path using the CONFIGURED STATICFILES_STORAGE.

{% load static %}<IMG src="{% static 'my_sample/abcxy.jpg' %}" alt="ABC image"&GT;

Store your static files in a folder called static in your app. For example my_sample/static/my_sample/abcxy.jpg



Discussion

No Comment Found