title: Flask Value error view function did not return a response
body: <p>Error message:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1836, in __call__
      return self.wsgi_app(environ, start_response)
    File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1820, in wsgi_app
      response = self.make_response(self.handle_exception(e))
    File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1403, in handle_exception
      reraise(exc_type, exc_value, tb)
    File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1817, in wsgi_app
      response = self.full_dispatch_request()
    File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1478, in full_dispatch_request
      response = self.make_response(rv)
    File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1566, in make_response
      raise ValueError('View function did not return a response')
  ValueError: View function did not return a response
  </code></pre>
  
  <p>And my code:</p>
  
  <pre><code>#Used for starting the flask server
  from flask import Flask #Import flask mains
  from flask import request #Import flask requests
  from flask import render_template #Import flask render templates
  import json, urllib #import api modules
  import time #Imporing time in darlek voice
  app = Flask(__name__)
  
  @app.route('/')
  def my_form():
      return render_template("my-form.html") #Set render template
  
  @app.route('/', methods=['POST'])
  def my_form_post():
      openwindow_at = float(request.form['open']) #When it reached ? open window
      if request.form['scale'] == "kelvin": #Change figures
          print("Do nothing") #Debug info
      elif request.form['scale'] == "celcius":
          openwindow_at = openwindow_at + int(273.15) #celcius to kelvin
      elif request.form['scale'] == "fah": #Fah to kelvin
          openwindow_at = (openwindow_at + 459.67) * 5 / 9  #F to kelvin
      text = request.form['text'] #Get info from First page
      url = "http://api.openweathermap.org/data/2.5/weather?q=" + text #Download the json
      response = urllib.urlopen(url) #Download Json
      data = json.loads(response.read()) #Parse json
      print("Current Weather in " + text + " " + data['weather'][0]['description']) #Debug infomation
      print("Temp: " + str(data['main']['temp'])) #Print temp 
  
      if data['weather'][0]['description'].find("rain") &gt;= 0: #Check The weather
          print("Test")
          return "Shutting your window"
          Close the window(Tom's job)
      if float(data['main']['temp']) &gt;= openwindow_at:
          return "Opening your window"
          #open the window (Tom's job)
  if __name__ == '__main__':
      app.debug = True #Uncomment to enable debugging
      app.run() #Run the Server
  </code></pre>
  
  <p>and <code>my-form.html</code> is:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;body&gt;
      &lt;h1&gt;Enter a place&lt;/h1&gt;
      &lt;form action="." method="POST"&gt;
          &lt;input type="text" name="text"&gt;
          &lt;input type="submit" name="my-form" value="Send"&gt;
      &lt;h1&gt;Options&lt;/h1&gt;
      &lt;p&gt;Open window if temp is greater than&lt;input type="textbox" name="open"&gt;&lt;/input&gt; &lt;input type="radio" name="scale" value="kelvin"&gt;Kelvin&lt;/input&gt;&lt;input type="radio" name="scale" value="celcius"&gt;Celcius&lt;/input&gt;&lt;input type="radio" name="scale" value="fah"&gt;FarenHeit&lt;/input&gt;&lt;/p&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>If I put a <code>while</code> loop there it loads for ever.</p>
  
  <p>Then enter a temp higher than the current one the page loads forever.
  And if I use the current code listed above it gives the error.</p>