【发布时间】:2015-03-21 21:50:19
【问题描述】:
我的文件结构:
根目录:
css [目录]
js [目录]
img [目录]
字体 [目录]
khikhi [目录]
应用程序.yaml
index.html
index.yaml
khikhi 目录:
css [目录]
js [目录]
img [目录]
index.html
App.yaml:
application: mywebsitesname
version: 1
runtime: python
api_version: 1
handlers:
- url: /(.*\.(svg|ttf|woff|woff2|gif|png|jpg|ico|js|css|eot))
static_files: \1
upload: (.*\.(svg|ttf|woff|woff2|gif|png|jpg|ico|js|css|eot))
- url: /robots.txt
static_files: robots.txt
upload: robots.txt
- url: /.*
script: main.py
Main.py:
# Copyright 2012 Digital Inspiration
# http://www.labnol.org/
import os
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from google.appengine.ext.webapp import template
class MainHandler(webapp.RequestHandler):
def get (self, q):
if q is None:
q = 'index.html'
path = os.path.join (os.path.dirname (__file__), q)
self.response.headers ['Content-Type'] = 'text/html'
self.response.out.write (template.render (path, {}))
def main ():
application = webapp.WSGIApplication ([('/(.*html)?', MainHandler)], debug=True)
util.run_wsgi_app (application)
if __name__ == '__main__':
main ()
目前,当我转到 mydomain.com 时,正在提供我根目录中的 index.html,但我希望在我转到 mydomain.com/khikhi/ 或 mydomain 时也提供 /khikhi/index.html .com/khikhi。我应该对文件进行哪些更改才能使其正常工作?
【问题讨论】: