title: Sending temperature value from sensor to Web-Page using Flask, Nginx and Raspberry-Pi
body: <p>I am working with Raspberry-PI,DHT22 Sensor , Flask Template and Nginx Web-server. I wrote and ran this code <b>test.py</b> :</p>
  
  <pre><code>
  from flask import Flask, render_template, request
  
  
  app = Flask(__name__)
  
  
  @app.route("/")
  def main():
  
      import sys
      import Adafruit_DHT
      humidity,temperature = Adafruit_DHT.read_retry(Adafruit_DHT.AM2302, 18)
      if temperature is not None:        
          return render_template("index.html",temp=('{0:0.1f}*'.format(temperature)))
  
  if __name__ == "__main__":
      app.run(host='0.0.0.0',debug=True,port=8080)
  
  
  </code></pre>
  
  <p>Here is the <b>index.html</b> code snippet :</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;
  &lt;head&gt;&lt;/head&gt;
  &lt;body&gt;
  &lt;p&gt;Current Temperature : {{temp}}&lt;/p&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>After running <b>test.py</b>. I am getting this kind of error onto the WEBPAGE -</p>
  
  <pre><code>Internal Server Error
  
  The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</code></pre>
  
  <h3><b>Please help me out and resolve this problem</b></h3>