简体   繁体   中英

Python Script downloading instead of running?

I am running Python 2.7 in Tomcat 6, which I have done for a while, but for some reason now when I go to my pages the browser attempts to download the file instead of running the script. I can get a simple hello.py to work as such:

#!/usr/bin/env python

print "Content-type: text/html\n\n"
print "<html>Hello World From CGI!</html>"

but if I try to add even just an import

import MySQLdb

then the browser tries to download the file. Any idea what's going on? How can I fix this?

Does maybe your import fail or something else in your script? What is actually downloaded? What do your logs say?

Imports were failing

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM