0
#!/usr/bin/python

print "Content-type:text/html\r\n\r\n"
print '<html>'
print '<head>'
print '<title>Hello Word - First CGI Program</title>'
print '</head>'
print '<body>'

from wsgiref.handlers import CGIHandler
from app import app

CGIHandler().run(app)

a=9
b=8
c=a+b
import test
d=test.addd(77,88)
print c
print d
print '<h2>Hello Word! This is my first CGI program</h2>'
print '</body>'
print '</html>'

"""The above code is in my cgi-bin folder as sumitup.py which works fine and gives the add   part of the code as result in the browser when I remove the below import part."""
from wsgiref.handlers import CGIHandler
from app import app

CGIHandler().run(app)

"""I had created a test.py and tried calling the addd method which is also working fine. Do I need to add the code of wsgiref.handlers library explicity in the same folder. Note:- I am trying to deploy flask app on a shared hosting www.techpython.com Can you help me for this.Thanks in advance."""

Sumit Raj
  • 113
  • 1
  • 3
  • 10

1 Answers1

0

CGIHandler handles the CGI request for you.

There is no need to print content-length or something like this.

On top of the CGIHandler you could use something like Werkzeug ( http://werkzeug.pocoo.net/ ).

YtvwlD
  • 132
  • 2
  • 9