Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html Django图像未加载页面未找到错误_Html_Css_Django_Django Templates - Fatal编程技术网

Html Django图像未加载页面未找到错误

Html Django图像未加载页面未找到错误,html,css,django,django-templates,Html,Css,Django,Django Templates,我是Django的新手,我面临着加载静态文件(图像)的问题。我得到 127.0.0.1/:1707获取http://127.0.0.1:8000/static/css/static/images/background/1.jpg 404(未找到) 我很确定问题已经解决了,但我不明白这个/static/css/是从哪里来的。你能帮帮我吗 My settings.py文件: STATIC_ROOT = os.path.join(BASE_DIR, 'static') STATIC_URL = '/s

我是Django的新手,我面临着加载静态文件(图像)的问题。我得到

127.0.0.1/:1707获取http://127.0.0.1:8000/static/css/static/images/background/1.jpg 404(未找到)

我很确定问题已经解决了,但我不明白这个/static/css/是从哪里来的。你能帮帮我吗

My settings.py文件:

STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATIC_URL = '/static/'
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'evillio/static')
]
My index.html文件:

<!-- First Page with Picture and Search Starts -->
    <section class="home-one home1-overlay **home1_bgi1**">
        <div class="container">
            <div class="row posr">
                <div class="col-lg-12">
                    <div class="home_content">
                        <div class="home-text text-center">
                            <h2 class="fz55">Find Your Dream Home</h2>
                            <p class="fz18 color-white">From as low as $10 per day with limited time offer discounts.</p>
                        </div>
检查页面时


是否在顶部包含{%load static%}

对于最新版本的Django,它在Setting.py中没有使用:

`STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATIC_URL = '/static/'
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'evillio/static')
]`
Django 3.1的代码更改如下:

`STATICFILES_DIRS = [
    BASE_DIR / "static",
    '/var/www/static/',
]`
阅读Django 3.1的文档,它在Django的早期版本中更新了一些代码。

`STATICFILES_DIRS = [
    BASE_DIR / "static",
    '/var/www/static/',
]`