0
Google 애플 리케이션 엔진에서 python2.5에서 python 2.7로 이동하려고합니다.python27을 사용하여 webapp2에서 index.html을 가져올 수 없습니다.
난 그냥 index.html을 얻을 수 없습니다. 나는 빈 웹 페이지를 얻는다. index.html은 .yaml 및 .py 파일과 동일한 디렉토리에 있습니다.
내가 어떻게 작동시키는 지 알 수 없으므로 튜토리얼이나 예제가 없거나 index.html을 렌더링하는 방법을 알려줍니다.
내가 발견 한 것은 'Hello World!'라고 쓰는 예제입니다. '거의 거기'가있는 예를 발견했지만, 그곳에는별로 없습니다. 여기
는 애플리케이션 제목이며
application: myapp
version: main
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /(.*\.(gif|png|jif|jpg|jpeg|ico|js|css))
static_files: \1
upload: (.*\.(gif|png|jpeg|jpg|ico|js|css))
- url: .*
script: main.application
을
의 main.py. 라인에서
import os
import webapp2
from google.appengine.ext.webapp import template
class BaseHandler(webapp2.RequestHandler):
def render_template(self, filename, **template_args):
path = os.path.join(os.path.dirname(__file__), 'templates', filename)
self.response.write(template.render(path, template_args))
class IndexHandler(BaseHandler):
def get(self):
self.render_template('index.html', name=self.request.get('name'))
application = webapp2.WSGIApplication([
('/', IndexHandler),
], debug=True)
정확히 작동하지 않는 기능은 무엇입니까? – dornhege
index.html을로드하지 않습니다. – stianlp