我正在尝试使用以下代码内联我的样式表:
视图.py
def index(request):
latest_course_list = Course.objects.order_by('-start_date')
template = loader.get_template('index.html')
style_sheets = ""
style_sheets = addStyle(style_sheets)
ctx = {
'latest_course_list': latest_course_list,
'style_sheets': style_sheets,
}
return render_to_response('index.html', ctx, context_instance=RequestContext(request))
def addStyle(style):
style_sheets=""
style_sheet_list = [
"bootstrap",
"custom-style",
"responsive",
"animate",
"flexslider",
"theme-style"
]
for sheet in style_sheet_list:
with open (DJANGO_ROOT + "/assets/css/" + sheet + ".css", "r") as myfile:
style_sheets+=myfile.read()
style_sheets+="\n"
return style_sheets
模板:
<style type="text/css">{{ style_sheets }}</style>
但它只在 animate.css 中下降到一半,然后切断并添加“......”
我在这里达到什么限制?我该如何解决?