简体   繁体   中英

Abyss web server and Python

I have got Abyss web server on my 64 bit computer. I followed the instructions regarded in this official link to add support to the server, regarding that I did not downloaded the Active Python considered in the documentation, I just used a previously installed Python 3.3 on my machine.

I have wrote very simple python script:

print("Hello")

Then I saved it as test.py in the server's htdocs, then I tried to access http://localhost:9090/test.py but the server returns Error 500 Internal Server Error the log line that record this error is:

cgi.log:

[21/Dec/2014:01:33:54 +0200] CGI: [C:\\Python33\\python.exe test.py ] URI: /test.py Bad CGI header line [Hello]

access.log:

127.0.0.1 - - [21/Dec/2014:01:33:54 +0200] "GET /test.py HTTP/1.1" 500 412 "" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36"

So how could I fix the CGI header line?

I found how to fix the CGI header, thanks to Himal , the idea is printing out content type followed by a blank line, then the script works fine:

print ("Content-Type: text/html")
print ()
print("<h1>Hello World!</h1>")

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