Google app engine googleappengine中的多个文件处理程序
我希望在google app engine(python 2.7)中有多个页面,下面是我的目录结构: 根目录包含:pujaweb.py(主脚本)、index.html、样式表(文件夹)、端口(文件夹) 现在,页面的第二个脚本位于port文件夹中,我希望配置index.html,使其链接到该页面。我尝试了很多东西,但不知怎么的,它不起作用,总是显示404页面未找到错误,命令行说PujaPort模块不存在(PujaPort是第二个页面的应用程序处理程序) 以下是my app.yaml文件代码:Google app engine googleappengine中的多个文件处理程序,google-app-engine,Google App Engine,我希望在google app engine(python 2.7)中有多个页面,下面是我的目录结构: 根目录包含:pujaweb.py(主脚本)、index.html、样式表(文件夹)、端口(文件夹) 现在,页面的第二个脚本位于port文件夹中,我希望配置index.html,使其链接到该页面。我尝试了很多东西,但不知怎么的,它不起作用,总是显示404页面未找到错误,命令行说PujaPort模块不存在(PujaPort是第二个页面的应用程序处理程序) 以下是my app.yaml文件代码: ap
application: thepujabhalerao
version: 1
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /images
static_dir: images
- url: /stylesheets
static_dir: stylesheets
- url: /port
script: pujaport.app
- url: /.*
script: pujaweb.app
libraries:
- name: jinja2
version: latest
这是我的主要处理程序(pujaweb.py)
索引文件管理器中的href如下所示:
<a href="/port/">P</a>
我知道这是某个地方的一个小故障,但请帮我解决,因为在使用它太长时间后,我可能错过了明显的问题。如果你坚持使用该文件夹结构,你需要将
端口
目录添加到一个包中,方法是向其中添加一个\uu init\uuuuuuuuuy.py
文件(可以是空的),并将应用程序引用为port.pujaport.app
,这是它的完全限定名。我按照您的说明操作,仍然没有找到404。我的目录结构test\u app/-app.yaml+login/+logout/-main.py app.yaml内容应用程序:测试版本:1运行时:python27 api\u版本:1线程安全:true处理程序:-url:/login/*脚本:login.login.app-url:/logout/*脚本:logout.logout.app-url:.*脚本:main.app库:-名称:webapp2版本:“2.5.2”请帮助我。
<a href="/port/">P</a>
import cgi
import webapp2
import jinja2
import os
from google.appengine.api import xmpp
from google.appengine.ext import db
jinja_environment = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)))
class PujaPort(webapp2.RequestHandler):
def get(self):
self.response.out.write("In handler")
app = webapp2.WSGIApplication([('/port', PujaPort)],
debug=True)