Can’t figure this out, should be an easy one for someone. Just getting a 500 server error reply and expecting it to show ‘success’.
import webapp2
page = """
<!DOCTYPE html>
<html>
<form method="post">
<input type="hidden" value="success" name="radius" >
<input type="submit">
</form>
</body>
</html>
"""
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.out.write(page)
def post(self):
radius = self.request.get("radius")
self.response.out.write(radius)
app = webapp2.WSGIApplication([('/', MainPage)], debug=True)
app.yaml is as follows
application: udatest85
version: 1
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: .*
script: main.app
libraries:
- name: webapp2
version: "2.5.1"
Hard to believe, but the problem is that I was using a mixture of tabs and spaces with my indentation. I removed the spaced indentation and replaced with tabs, problem solved.
Also, I was using notepad++ to write the code. Have since moved to PyCharm.
Thanks for your help, it’s going to solve a lot of headaches for me from now on.