How to implement HTML file into GAE project and solution of bindError

These days, I learnt some knowledge about GAE based on python. 

there are two files which is very important, the first one is app.yaml the other is main.py.

We should focus on main.py, where our source code stored there. 

Somebody may get the bindError. Below is the instruction of how to deal with it.

you should terminate those port which is still in use. I recommend you using Pycharm IDE. pressing the red square button to terminate the on going program. Then you can perfectly solve this problem.

The source code of how to implement HTML file into GAE is as follows:

# coding=utf-8
import webapp2

def mainForm():
    return """
        <html>
            <head>
	            <meta charset = 'utf-8'>
	            <title>客户信息表</title>

            </head>
            <body>
            <h1>User Information</h1>
            <form method = "post">
                <p>First name : <input type = "text" name = "fname" /></p>
                <p>Last name : <input type = "text" name = "lname" /></p>
                <input type = "submit" value = "Save" />
            </form>

        </body>
        </html>
    """

class MainHandler(webapp2.RequestHandler):

  def get(self):
    self.response.out.write(mainForm())
  def post(self):
      firstname = self.request.get("fname")
      lastname = self.request.get("lname")
      self.response.out.write("First Name: " + firstname + "\n")
      self.response.out.write(" Last Name: " + lastname)



app = webapp2.WSGIApplication([
    ('/.*', MainHandler),
], debug=True)


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值