小编Zan*_*ato的帖子

无法在python加载的模板中引用css样式表

我是使用Python的新手,在尝试从.tpl文档引用我的样式表时遇到了一个问题.我的python,template和css文件都在同一个目录中,但是当我使用CMD将页面加载到"localhost:8080"时,它显示的模板没有应用样式.

在我的模板文档index.tpl中,我引用了三个样式表:

<link rel="stylesheet" type="text/css" href="demo.css" />
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="stylesheet" type="text/css" href="animate-custom.css" />
Run Code Online (Sandbox Code Playgroud)

我的python文件输出模板:index.py:

from bottle import route,template,debug,run
import sqlite3

@route('/')
def player():
    return template('index.tpl')

debug(True)
run(reloader=True)
Run Code Online (Sandbox Code Playgroud)

python bottle

5
推荐指数
1
解决办法
5441
查看次数

标签 统计

bottle ×1

python ×1