Bootstrap模板无法正常工作Django [英] Bootstrap template not working correctly Django

查看:58
本文介绍了Bootstrap模板无法正常工作Django的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Bootstrap模板,我正在尝试将其与Django一起使用,并且我将Bootstrap资源与要显示的html文件放在了模板目录中.我的问题是,当尝试显示html文件时,它仅以文本形式出现在浏览器窗口中,因此这使我相信Bootstrap资源没有得到正确使用.

I have a Bootstrap template that I am attempting to use with Django, and I have places the bootstrap resources in the template directory with the html file that I am trying to display. My problem is that when trying to display the html file, It only comes out as text in the browser window, so this would lead me to believe that the Bootstrap resources are not being properly used.

这是我要使用的模板: http://startbootstrap.com/template-overviews/stylish-portfolio/

Here is the template I am trying to use: http://startbootstrap.com/template-overviews/stylish-portfolio/

这是我的模板目录的样子:

Here is what my template directory looks like:

css
font-awesome
fonts
img
js
index.html

我知道它使用CDN链接,但是下载zip时资源与模板一起使用,因此我将其保留在那里.我是Bootstrap的新手,也是Django的新手,所以请放心,如果我的术语有误,请更正我.谢谢.

I am aware that It uses CDN links, but the resources were with the template when I downloaded the zip, so I left the in there. I am very new to Bootstrap and fairly new to Django as well so please go easy on me, and If I have something wrong in my terminology, please correct me. Thanks.

推荐答案

您需要声明一个放置CSS和JS文件的静态文件夹.

You need to declare a static folder where you place the CSS and JS files.

请参阅 https://docs.djangoproject.com/cn/1.7/howto/static-files/关于如何设置静态文件夹

Refer to https://docs.djangoproject.com/en/1.7/howto/static-files/ on how to setup the static folder

示例实现 https://github.com/Dsupreme/fests-django (重点放在css文件的放置位置以及它们的调用方式

A sample implementation https://github.com/Dsupreme/fests-django (Focus on where the css files are placed and how they are called)

这篇关于Bootstrap模板无法正常工作Django的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆