为什么JavaScript不能在Centos上获取Django标记值,但在Windows中这是正常的

2024-10-02 16:20:39 发布

您现在位置:Python中文网/ 问答频道 /正文

<style type="text/css">
#bk {
{% load staticfiles %}
background-image: url({% static "1.gif" %});
background-repeat: no;
background-color: yellow;}
</style>
<script type="text/javascript">
function fresh()
{
  document.getElementById("bk").src="{% url 'freshpic' %}";
  alert("fresh function1");
};
</script> 
</head>
<body id="bk">
   Hello My first Stackoverflow
 <button id='refresh' type="button" onclick="fresh()">FRESH</button>
 </body>

我无法在Centos上获得{% url 'freshpic' %的响应,但在Windows上是正常的,{% static "1.gif" %}在两个操作系统上都是正常的。另外,我们用Centos 6.6+uwsgi2.0.8+django1.7+Python3.4部署,有人有经验吗?谢谢


Tags: textidurlstyletypescriptstaticbody