我正在學習web2py 1.98.2,所以問題是非常基本的。在靜態/ css文件夾我創建了以下內容basic.css文件:web2py鏈接到CSS
.auth_navbar {
top: 0px;
float: right;
padding: 3px 10px 3px 10px;
}
在的layout.html我:
<head>
...
{{response.files.append(URL('static','css/base.css'))}}
...
</head>
<body>
...
{{try:}}{{=auth.navbar(action=URL('default','user'))}}{{except:pass}}
...
</body>
控制器default.py具有非常簡單的代碼:
def index(): return dict(message="hello people")
,最後是缺省的/ index.html的樣子:
{{extend 'layout.html'}}
<h2>This is the default/index.html template</h2>
{{#=BEAUTIFY(response._vars)}}
所以,我運行的應用程序和index.html顯示爲預期。但是,CSS不起作用。 我預計在頁面的源代碼以下行:
<link href="/welcome/static/css/base.css" rel="stylesheet" type="text/css" />
,但它不存在。我錯過了什麼?
我對你的答案做了一個小的修改,以便它有資格作爲答案(要求澄清不應該發生在答案中)。 –
謝謝Tim,我不知道! :) – Jarrod