Python Forum

Full Version: Django CSS
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all.
I downloaded a free website template from travello website. In html file I am configuring CSS , I used {% load static %} at beginning of index.html file
at style {% static ''%} at script {% static''%} i used those lines. The issue is I am not getting CSS styles and images on my Django website .What should I do to get images and styles to my website in index.html. Please see my attachment to understand my problem.
Thanks for your support in advance!
add this tag at the top of your html file:

Output:
{% load static %}
add django.contrib.staticfiles in the installed apps of your settings.py file

INSTALLED_APPS = [
    ...
    'django.contrib.staticfiles',
    ...
]
and check this setting or add these lines into your settings.py file

Output:
STATIC_URL = '/static/' STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')] STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
you can check my blog post about static files here: https://web-spidy.com/manage-django-static-files-images-javascript-css/

Or you can dm me.