我在windows 7上使用python 3.7.4、django 3.06、javascript和jquery。
我不确定何时会发生这种情况,但现在我的控制台(火狐上的F12)给了我以下警告:
Cookie “PGADMIN_KEY” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/lists/list-name/” because the scheme does not match. list-name
Cookie “PGADMIN_LANGUAGE” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/lists/list-name/” because the scheme does not match. list-name
Cookie “PGADMIN_KEY” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/lists/list-name/” because the scheme does not match. list-name
Cookie “PGADMIN_LANGUAGE” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/lists/list-name/” because the scheme does not match. list-name
Cookie “PGADMIN_KEY” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/static/js/common.js” because the scheme does not match. common.js
Cookie “PGADMIN_LANGUAGE” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/static/js/common.js” because the scheme does not match. common.js
Cookie “PGADMIN_KEY” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/static/lists/js/lists.js” because the scheme does not match. lists.js
Cookie “PGADMIN_LANGUAGE” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/static/lists/js/lists.js” because the scheme does not match. lists.js
Cookie “PGADMIN_KEY” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/jsi18n/” because the scheme does not match. jsi18n
Cookie “PGADMIN_LANGUAGE” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/jsi18n/” because the scheme does not match. jsi18n
Cookie “PGADMIN_KEY” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/static/icons/favicon.png” because the scheme does not match. favicon.png
Cookie “PGADMIN_LANGUAGE” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/static/icons/favicon.png” because the scheme does not match. favicon.png我正在测试我的代码,我对它做了一些修改,但与cookies或管理员无关,而且我的站点对cookie的使用非常有限。PGADMIN_KEY和PGADMIN_LANGUAGE看起来像django管理cookie,我还没有碰过它们。jsi18n是django的传输模块:不是我的代码,我把它当作是。
这些天我都没做升级了。
我不知道你需要什么代码来帮我。
我在我的模板中使用了这一点(我看到jquery.cookie没有更多更新,但即使是js.cookie.min.js也存在同样的问题):
<script type='text/javascript' src=' http://cdn.jsdelivr.net/jquery.cookie/1.4.1/jquery.cookie.min.js '></script>
<script type='text/javascript' src="{% static '/js/common.js' %}"></script>
<link rel='icon' type='image/png' href="{% static 'icons/favicon.png' %}">这也适用于cookies:
var csrftoken = $.cookie('csrftoken');
function csrfSafeMethod(method) {
// these HTTP methods do not require CSRF protection
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
}
$.ajaxSetup({
beforeSend: function(xhr, settings) {
if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
xhr.setRequestHeader('X-CSRFToken', csrftoken);
};
}
});发布于 2020-07-30 07:59:33
正如在一条删除的评论中所说的,这些警告应该来自关于cookie的新政策。cookies来自pgAdmin,包括在PostgreSQL中。
我解决了升级到最后一个版本的pgAdmin和删除缓存中存储的cookie的问题。
发布于 2020-08-02 10:13:25
类似的错误,但没有python或django,通过清除cookie解决了(\ Storage Storage.)并刷新页面。
https://stackoverflow.com/questions/62831964
复制相似问题