how to point correctly to static image in django

后端 未结 3 2176
再見小時候
再見小時候 2020-12-24 04:28

I have a template that renders an image:

{% load staticfiles %}

\"My

The im

3条回答
  •  误落风尘
    2020-12-24 05:09

    If you are in development mode then define just one line:

    STATICFILES_DIRS = ( os.path.join('static'), )
    

    You don't need to define STATIC_ROOT = '/Users/myuser/myprojectname/myprojectname'

    OR

    STATICFILES_DIRS as BASE_DIR

    So, working solution is :

    STATIC_URL = '/static/'
    
    STATICFILES_DIRS = ( os.path.join('static'), )
    

提交回复
热议问题