简体   繁体   English

如何关闭 static 文件的自动更新? 在 django (python)

[英]How do I turn off auto-update on static files? in django (python)

I want change css.我想更改 css。 when i change continer height for oncklick function, after 1 second returns the same size, and when i have error console refresh in 1 second and i can't see.当我更改 oncklick function 的 continer 高度时,1 秒后返回相同的大小,并且当我在 1 秒内出现错误控制台刷新并且我看不到时。 how fix?如何修复? i turn off livereload plugin.It refreshes everything in 1 second.我关闭 livereload 插件。它会在 1 秒内刷新所有内容。

when i delete {% now "U" %} to css link rel after css is crashed and not work why?当我在 css 崩溃后将 {% now "U" %} 删除到 css 链接 rel 并且不起作用时,为什么? this is problem?这是问题吗?

this is my codee--->这是我的代码--->

base.html底座.html

<!DOCTYPE HTML>

<html>
<head>
    <title>home</title>
</head>

<link rel="stylesheet" type="text/css" href="/static/css/style.css?{% now "U" %}" />


<body>


{% block content %}
{% endblock %}

<script src="/static/js/homescript.js"></script>
</body>
</html>

home.html主页.html

{% extends 'base.html' %}
<link rel="stylesheet" type="text/css" href="/static/css/style.css?{% now "U" %}" />

{% block content %}

    <form action = '' method="post" novalidate="novalidate">
        {% csrf_token %}
        <div class="continer">
        {% for field in form %}
        {{ field.label_tag }}
        {{ field }}
        {{ field.errors }}
        {% endfor %}
        <input type="submit" name="register" id="btn" onClick = "document.querySelector('#continer').style.height = '200px';">
        </div>
    </form>

{% endblock %}

style.css样式.css

@import url("//cdn.web-fonts.ge/fonts/bpg-glaho-arial/css/bpg-glaho-arial.min.css");

html,body{
    background-image: url("../img/test.jpg") ;
    background-position: center center;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-attachment: fixed;
    padding: 0;
    margin: 0;
}

.continer {
    position: absolute;
    width: 300px;
    height:400px;
    background-color: blue;
}

.inp{
    margin: 3px;
    margin-left: 57px;
    width: 180px;
    height: 20px;
    border-radius: 5px;
    border: none;
    outline: none;

}

input,label {
    display:block;
    font-family: "BPG Glaho Arial", sans-serif;
    text-align: center;

}

.btn{
    margin-bottom: 20px;
}

.errorlist{
    background-color: red;
    border-radius: 2px;
    width: 220px;
    list-style-type: none;
    margin-left: 20px;
    color:white;
    text-align: center;

}
.errorlist li{
    padding-right: 28px;
    font-family: "BPG Glaho Arial", sans-serif;

}

Put the link tag in head tag in base.html将链接标签放在base.html的head标签中

Remove this line in home.html去掉 home.html 中的这一行

<link rel="stylesheet" type="text/css" href="/static/css/style.css?{% now "U" %}" />

And the main thing, in this line in home.html:最重要的是,在 home.html 的这一行中:

<input type="submit" name="register" id="btn" onClick = "document.querySelector('#continer').style.height = '200px';">

it is not它不是

#container

it is这是

.container

class names can be accessed by (.) and id names can be accessed by (#) class 名称可以通过 (.) 访问,id 名称可以通过 (#) 访问

so replace that line with:所以将该行替换为:

<input type="submit" name="register" id="btn" onClick = "document.querySelector('.continer').style.height = '200px';">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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