Google app engine HTTP error 500
<p>I just installed Google app engine for Python 2.7 and I wrote some code for test. Just a simple HTML form. Here is the code:</p>

<pre><code>import webapp2

form = """
&lt;form method="post"&gt;
    What is your birthday?
    &lt;br&gt;
    &lt;label&gt; Month
        &lt;input type="text" name="month"&gt;
    &lt;/label&gt;

    &lt;label&gt; Day
        &lt;input type="text" name="day"&gt;
    &lt;/label&gt;

    &lt;label&gt; Year
        &lt;input type="text" name="year"&gt;
    &lt;/label&gt;

    &lt;br&gt;
    &lt;br&gt;
    &lt;input type="submit"&gt;
&lt;/form&gt;
"""

class MainPage(webapp2.RequestHandler):
    def get(self):
        self.response.out.write(form)

    def post(self):
        self.response.out.write("Succes!")

app = webapp2.WSGIApplication([
     ('/', MainPage),
], debug=True)
</code></pre>

<p>And then I tried to write a separate procedure that writes out my form, like so:</p>

<pre><code>import webapp2

form = """
&lt;form method="post"&gt;
    What is your birthday?
    &lt;br&gt;
    &lt;label&gt; Month
        &lt;input type="text" name="month"&gt;
    &lt;/label&gt;

    &lt;label&gt; Day
        &lt;input type="text" name="day"&gt;
    &lt;/label&gt;

    &lt;label&gt; Year
        &lt;input type="text" name="year"&gt;
    &lt;/label&gt;

    &lt;br&gt;
    &lt;br&gt;
    &lt;input type="submit"&gt;
&lt;/form&gt;
"""

class MainPage(webapp2.RequestHandler):
    def write_form(self):
        self.response.out.write(form)

    def get(self):
        self.write_form()

    def post(self):
        self.response.out.write("Succes!")

app = webapp2.WSGIApplication([
     ('/', MainPage),
], debug=True)
</code></pre>

<p>Well, the thing is that the first code is working fine, but the second one is returning the HTTP error 500. I tried this out from a course on Udacity and I simply copied the code from there. I really don't know why it's not working.</p>

<p>PS. I see this message in terminal (Linux): "IndentationError: unindent does not match any outer indentation level
INFO     2016-08-29 12:17:37,155 module.py:788] default: "GET / HTTP/1.1" 500 -"</p>

<p>Later Edit: I solved this by simply writing the "write_form" procedure after the "get" procedure inside the MainPage class.</p>

<p>You have probably mixed up tabs and spaces. See this answer for more information and hints on how to fix it: <a href="http://stackoverflow.com/a/3920674/3771575">http://stackoverflow.com/a/3920674/3771575</a></p>

python google-app-engine