python - Use Mac's built-in Apache server to develop CGI, and directly output plain text in the browser? Solve
ringa_lee
ringa_lee 2017-05-18 10:50:34
0
1
605

httpd.conf file page configuration and installation tutorial
http://blog.csdn.net/dabiaoya...
Step by step
File permissions are as follows

GhostClock:WWW ghostclock$ ls -al Test.py 
-rwxr-xr-x  1 ghostclock  staff  410 May  9 20:40 Test.py
GhostClock:WWW ghostclock$ 

After entering localhost/Test.py in the browser, plain text is printed

#!/usr/bin/env python
# -*- coding: UTF-8 -*-
print "Content-type:text/html"
print                               # 空行,告诉服务器结束头部
print '<html>'
print '<head>'
print '<meta charset="utf-8">'
print '<title>Hello Word - CGI 程序!</title>'
print '</head>'
print '<body>'
print '<h2>Hello Word! 第一CGI程序</h2>'
print '</body>'
print '</html>'

I don’t know where my environment is not configured properly, please solve it

ringa_lee
ringa_lee

ringa_lee

reply all(1)
Peter_Zhu

Have you added itAddHandler cgi-script .py? Remember to restart apache after adding it

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template