简体   繁体   中英

how do I configure my staticfiles in django?

I followed the procedures to setup staticfiles but I'm not getting what i want设置.py

when I add an image to the section background it gives a wrong path "staticfiles/css/assets/img/oilcarriage.jpg" 注册文件

instead of "staticfiles/assets/img/oilcarriage.jpg" here's the path to the image: 图片的路径

i would be really grateful if you can help me now :)

您必须加入路径,因此请使用以下STATICFILES_DIRS = (os.path.join(BASE_DIR, 'staticfiles'),)

Here you go static file config in settings.py file

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'static')
]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM