我试图部署我的个人网站,但运行我的网站时遇到了一个大错误在本地主机中一切运行良好。但我已通过Google应用部署了我的网站,但它不起作用。我不断收到此错误Here is a screenshot of the error I getTemplateNotFound:在Google应用引擎上部署网站时出现模板/ HomePage.html错误,但在本地主机上运行时网站运行良好
我不知道为什么它这样做是因为该Homepage.html文件位于模板文件夹内。 This a screenshot of my file path and the Python code I wrote。 这个代码我写
import jinja2
import os
import webapp2
import logging
from google.appengine.api import users
from google.appengine.ext import ndb
import datetime
import json
import unicodedata
from google.appengine.api import users
# the two lines of code below makes the jinja work
jinja_environment = jinja2.Environment(loader=
jinja2.FileSystemLoader(os.path.dirname(__file__)))
class HomePage(webapp2.RequestHandler):
def get(self):
template =
jinja_environment.get_template('templates/HomePage.html')
self.response.write(template.render())
class AboutMe(webapp2.RequestHandler):
def get(self):
template = jinja_environment.get_template('templates/Aboutme.html')
self.response.write(template.render())
class Contact(webapp2.RequestHandler):
def get(self):
template = jinja_environment.get_template('templates/Contact.html')
self.response.write(template.render())
class Projects(webapp2.RequestHandler):
def get(self):
template =
jinja_environment.get_template('templates/Projects.html')
self.response.write(template.render())
app = webapp2.WSGIApplication([
('/', HomePage), #HomePage
('/AboutMe.html',AboutMe),
('/Contact.html',Contact),
('/Projects.html',Projects)
], debug=True)
}
这里是我的app.yaml文件
application: israel-ali
version: 1
runtime: python27
api_version: 1
threadsafe: yes
# order matters always have this order
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: /resources
static_dir: static_folder
- url: .*
script: main.app
libraries:
- name: jinja2
version: latest
- name: webapp2
version: "2.5.2"
[在这里输入的形象描述] [3]
请粘贴代码,而不仅仅是代码的图像。 – DIF
更好吗? – Izzy
欢迎来到SO!回溯也是如此 - 除非图像包含相关的视觉信息,否则不要发布文字图像。 –