저는 HTML 폼을 만들고 파이썬을 사용하여 코드를 작성하고 있습니다. Apache 버전 2.2와 Python 버전 2.6을 설치했습니다. 코드는 다음과 같습니다.Python Apache 로컬/내부 서버 오류?
#!C:\Python26\Python.exe -u
#import cgi modules
import cgi
#create instances of field storage
form = cgi.FieldStorage()
#get data from the fields
first_name = form.getvalue('first_name')
last_name = form.getvalue('last_name')
print "Content-type:text/html\r\n\r\n"
print "<html>"
print "<head>"
print "<title>Hello - Second CGI Program</title>"
print "</head>"
print "<body>"
print "<h2>Hello %s %s</h2>" % (first_name, last_name)
print "</body>"
print "</html>"
필자가 작성한 코드는 내부 오류를 발생시킵니다. 하지만 다음 줄을 제거하면 제대로 실행됩니다.
#import cgi modules
import cgi
#create instances of field storage
form = cgi.FieldStorage()
#get data from the fields
first_name = form.getvalue('first_name')
last_name = form.getvalue('last_name')
가 나는 아파치 설정 파일과 추가 라인 편집 :
AddHandler에의 CGI 스크립트를 .cgi로 평가 .pl
는 ScriptAlias / cgi를-빈/"C :/프로그램 파일 (86)/Apache Software Foundation/Apache2.2/cgi-bin/"
줄을 추가 할 때 내부 오류 메시지가 표시되는 이유는 무엇입니까? 그리고, 나는 파이썬에서 HTML 폼을 만드는 것에 익숙하지 않다. Windows 용 Python을 사용하는 HTML 양식에 대한 자습서에 대한 제안이 도움이 될 것입니다. 감사합니다. .
추신 : 스크립트가 포함 된 파일은 cgi-bin Apache 폴더에 있습니다.
apache error.log의 관련 비트를 게시 할 수 있습니까? – alecwh