HTTP错误500 - Python

时间:2017-03-16 12:42:55

标签: python google-app-engine

我收到错误' localhost目前无法处理此请求。 HTTP错误500' 这是我的代码:

import webapp2

form="""
<form method="post">
    Signup
    <br>
    <br>
    <label>Username
    <input type="text" name="username">
    </label>
    <br>
    <br>
    <label>Password
    <input type="text" name="password">
    </label>
    <br>
    <br>
    <label>Verify Password
    <input type="text" name="verify">
    </label>
    <br>
    <br>
    <label>Email(optional)
    <input type="text" name="email">
    </label>
    <br>
    <br>
    <input type="Submit">
</form>
"""
import re
def valid_username(username):
    USER_RE = re.compile(r"^[a-zA-Z0-9_-]{3,20}$")
    if USER_RE.match(username):
        return True
    else:
        return False

def valid_password(password):
    USER_RE = re.compile(r"^.{3,20}$")
    if USER_RE.match(password):
        return True
    else:
        return False

def valid_email(email):
    USER_RE = re.compile(r"^[\S]+@[\S]+.[\S]+$")
    if USER_RE.match(email):
        return True
    else:
        return False

class MainHandler(webapp2.RequestHandler):
    def get(self):
        self.response.write(form)
    def post(self)
        right_username=valid_username(self.request.get("username"))
        right_password=valid_password(self.request.get("password"))
        right_email=valid_email(self.request.get("email"))

        if not(right_username and right_password and right_email):
            self.response.write(form)
        else:
            self.response.write("Thanks! That's totally a valid day!")


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

添加功能后,我收到的错误是我无法找到的。 请帮帮我,并告诉我如何查看我的错误存储在计算机中的哪个位置。

0 个答案:

没有答案