Reputation: 2417
I am creating a Django website and have created a login pages for the website. When I run this on the development server the CSS for the page loads but the images and JavaScript are returning a 404 error. but they are in the same assets folder.
Folder Structure:
settings.py:
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'assets')]
Login.html:
<div class="h-center">
<img class="logo" src="{% static 'assets/base/img/logo/logo.jpg' %}">
</div>
I don't understand why it is only loading the CSS files.
Upvotes: 1
Views: 88
Reputation: 568
comment the STATIC_ROOT like this:
STATIC_URL = '/static/'
# STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'assets')]
STATIC_ROOT is for command "collectstatic"
Upvotes: 1