试图在Django中修复css路径

时间:2014-12-05 18:41:30

标签: python html css django twitter-bootstrap

enter image description here

我正在使用bootstrap在django项目上本地工作。结构截图在上面:

我在index.html中有以下内容:

<!DOCTYPE html>
<html lang="en">    

<head>  

    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="description" content="" />
    <meta name="author" content="" />   

    <title>Landing Page - Start Bootstrap Theme</title> 

    <!-- 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" />    

    <!-- Custom Fonts -->
    <link href="{% static "font-awesome-4.2.0/css/font-awesome.min.css" %}" rel="stylesheet" type="text/css" />
    <link href="http://fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css" />  

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->    

</head>

在我的settings.py中,我有:

STATIC_URL = '/static/'

TEMPLATE_DIRS = (
    os.path.join(BASE_DIR,  'templates'),

当我打开“http://onetwentyseven.0.0.1:8000/index/”时,我看到了html但引导程序的css样式不存在。在开发工具我看到:

enter image description here

如何修复CSS路径?

1 个答案:

答案 0 :(得分:0)

这似乎是一个语法错误。如果将css目录从静态&gt; app1&gt; css移动到static&gt; css。它应该工作得很好