我正在Python應用程序在谷歌App Engine中的webapp2框架。我一直使用Jinja2作爲我的模板引擎和Twitter Bootstrap進行樣式設計。在構建了一個漂亮的「layout.html」並讓所有其他模板從「layout.html」繼承之後,我部署了它。所有頁面都會呈現屬性,除了一個網址是動態網址的網頁。抓住所有網站抓住所有重新渲染css
這裏是WSGI處理程序是什麼樣子:
webapp2.WSGIApplication = ([('/login', LoginPage),
('/updates', Update),
('/updates/.*', Individual)],
debug = True)
# as you can see I'm using the catchall regex for Individual
在功能上,每個動態生成的URL通過個人妥善處理工作。這裏是處理程序,同樣,處理程序中的所有內容都正在執行。
class Individual(Handler):
def get(self):
url_u = str(self.request.url)
posit = url_u.find('updates')
bus1 = url_u[posit+8:]
bus = bus1.replace('%20', chr(32))
b = BusUpdates.all()
this_bus = b.order('-timestamp').filter('bus = ', bus).fetch(limit=10)
name = users.get_current_user()
user = None
if name:
user = name.nickname()
logout = users.create_logout_url(self.request.uri)
self.render("individual.html", bus=bus, user=user, this_bus=this_bus, logout=logout)
一個典型的URL看起來像: http://www.megabusfinder.appspot.com/updates/St%20Louis,%20MO-Chicago,%20IL-4-12-930AM-310PM
這裏是我的app.yaml文件
application: megabusfinder
version: 1
runtime: python27
api_version: 1
threadsafe: no
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: /static/stylesheets
static_dir: static/stylesheets
- url: /twitter-bootstrap-37d0a30
static_dir: twitter-bootstrap-37d0a30
- url: /static/xml
static_dir: static/xml
- url: .*
script: main.app
builtins:
- remote_api: on
libraries:
- name: webapp2
version: "2.5.1"
- name: jinja2
version: latest
現在,我以前有 「individual.html」 從我的「佈局繼承html的」。大約一個小時前,我不再那樣做了,我已經手動將「layout.html」中使用的所有必要的引導程序添加到「individual.html」中。即使如此,沒有任何造型效果。
在此先感謝。
你是否檢查過你可以手動下載css? 如果不檢查你的app.yaml。 – 2013-04-10 02:01:15