초급 질문입니다. 내 CSS가 Google App Engine에서 작동하도록 할 수 없습니다.Google App Engine에서 CSS를 사용할 수 없습니다.
내 YAML 파일은 다음
application: helloworld27dec
version: 1
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /stylesheets/
static_dir: stylesheets
- url: /.*
script: helloworld.application
내 파이썬 스크립트 (helloworld.py)가 다음과 같은 코드가 있습니다
import webapp2, cgi, re, datetime
class MainPage(webapp2.RequestHandler):
def render(self,htmlfile):
with open(htmlfile, 'r') as content_file:
if (content_file):
content = content_file.read()
return content
def get(self):
self.response.write(self.render('test2.html'))
application = webapp2.WSGIApplication([('/', MainPage)], debug=True)
내 html 파일 (test2.html)를 다음과 같습니다
<!doctype HTML>
<html>
<head>
<meta charset="utf-8">
<title> My Title </title>
<link type="text/css" rel="stylesheet" href="/stylesheets/style.css" />
</head>
<body>
<h1> Hello World!</h1>
</body>
</html>
내 CSS (style.css)는/stylesheets 폴더에 있으며 다음과 같습니다 :
<style>
h1{
color: red;
background: yellow;
}
</style>
나는 CSS 작업을 볼 수 없습니다. 빨간색 글꼴 및 노란색 배경). 나는 많은 것들을 시도했지만, 나는 아주 근본적인 실수를하고있는 것처럼 보입니다. 09 : 30,532 module.py:617] 기본 :
이 내가 로그 파일에
정보 2014년 1월 9일 (18)을 얻을 것입니다 "GET /stylesheets/style.css HTTP/1.1"304 -
여기서 내가 실수로하고있는 것에 대해 도움/설명을 해주시면 감사하겠습니다.
잘못된 것은없는 것처럼 보입니다. 304는 수정되지 않았습니다. 즉, 캐시 된 버전을 사용하게됩니다. –
캐싱 기간을 줄이기 위해 app.yaml에'default_expiration : "0d 0h 1m"을 추가하십시오. 생산에 가져 오는 효과에주의를 기울이십시오 –
감사합니다 지미. 나는 default_expiration을 추가하려고했다 : "0d 0h 1m". 아직도 CSS가 작동하지 않습니다. 헤더에 CSS를 넣으면 너무 단순 해 보이고 작동하기 때문에 좌절합니다. – akrishnamo