0

I'm trying to display an image located in my static directory. Here is my code :

My directories

enter image description here

My static settings

enter image description here

And finally, my template enter image description here

1
  • Where are your images/* files currently located? in static older or staticfiles folder? Commented May 10, 2018 at 7:00

2 Answers 2

1

You have a typo in your settings.py

instead of STATICFILES_DIR, add the S

STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'static'),
]
Sign up to request clarification or add additional context in comments.

1 Comment

glad to be of help!
0

Use below setting

STATIC_URL = '/static/'

STATIC_ROOT = os.path.join(BASE_DIR, 'static')

STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'staticfiles')
]

and move your image files to static folder

Difference between STATIC_ROOT, STATICFILES_DIRS and STATIC_URL can be found here

1 Comment

STATIC_ROOT can't be the same as STATICFILES_DIRS, and it's the place to collect static files for deployment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.