在django中配置%static的输出

时间:2018-10-18 19:29:45

标签: python django

enter image description here

我正在尝试使用django-distill(https://github.com/mgrp/django-distill)从django项目中生成一个静态站点。我正在使用django 1.10.8。我的主模板包含:

<!-- Bootstrap Core CSS -->
{% load staticfiles %}
<link href="{% static "css/bootstrap.min.css" %}" rel="stylesheet" />

<!-- Custom CSS -->
<link href="{% static "css/landing-page.css" %}" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/jquery.slick/1.5.0/slick.css"/>

当我在Windows系统上本地运行项目时,css和js文件的路径正确。但是,当我查看源html时,会看到:

enter image description here

在我的Windows系统上,它与正在运行的服务器配合使用,即

 http://127.0.0.1:8000/static/css/bootstrap.min.css

但是它与静态文件中断,我必须将其更改为

<link href="./static/css/bootstrap.min.css" rel="stylesheet" />

有什么方法可以将%static设置为

./static/ instead of /static/

0 个答案:

没有答案