简体   繁体   English

使用python的google app引擎

[英]google app engine using python

I am a really beginner of google app engine and trying to figure out how to create a link to the other pages. 我是Google App Engine的真正初学者,并试图弄清楚如何创建指向其他页面的链接。 Like after the user sign in, I want that there is link button that can redirect the users to some other pages I created .Thank you so much 就像在用户登录后一样,我希望有一个链接按钮可以将用户重定向到我创建的其他页面。非常感谢

Do you already understand how to create pages? 您已经了解如何创建页面吗? If so, then linking between pages is just basic HTML: 如果是这样,则页面之间的链接只是基本的HTML:

<a href="/path/to/some/page">link text</a>

To create a link to the other pages in Google app engine using python: For example: hyperlink: <a href="/addproduct"> where /addproduct refer to the name of the class in .py file, Here is how the addproduct class is defined in .py file 要使用python在Google App Engine中创建指向其他页面的链接:例如:超链接: <a href="/addproduct">其中/addproduct指向.py文件中的类的名称,这是addproduct类的方式在.py文件中定义

class addproduct(webapp2.RequestHandler):
    def get(self):
        template = JINJA_ENVIRONMENT.get_template('adminaddproduct.html')
        self.response.write(template.render())

Redirect is easy: 重定向很容易:

self.redirect("/home")

Example app also shows how users are redirected to the app after signing in. 示例应用程序还显示了登录后如何将用户重定向到该应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM