[Tutor] python cgi single double quotes

nitin chandra nitinchandra1 at gmail.com
Tue Jul 19 14:43:36 EDT 2016


I wrote python+cgi script on hostgator server and I could embed html like:-

code folder :- /home/userName/public_html/*.cgi

#!/usr/bin/env python

print "Content-Type:text/html\n\n"

print """<html>

<script type='text/javascript'
<script type='text/javascript' src='js/infinite-rotator.js'></script>



The above style / way of coding works. Even on my laptop where the
code is in /var/www/<projDir>

Now I have taken a VPS, using command line, I installed apache2.4,
python 2.7, but I am not able to use the same code with triple quotes
(""") to open and close the code block.

I am forced to use

#!/usr/bin/env python

import cgi
import psycopg2

print "Content-type:text/html\r\n\r\n"
print '<html>'
print '....'
print '...'
print '</html>'

Do I need to do some thing to apache config such that I can use Triple
quote to embed.

Also, if I ReUse some of the previous code, it give 500 error.

Any solutions ?



More information about the Tutor mailing list