【发布时间】:2014-02-28 18:47:53
【问题描述】:
http://www.tutorialspoint.com/python/python_cgi_programming.htm
#!/usr/bin/python
print "Content-type:text/html\r\n\r\n"
print '<html>'
print '<head>'
print '<title>Hello Word - First CGI Program</title>'
print '</head>'
print '<body>'
print '<h2>Hello Word! This is my first CGI program</h2>'
print '</body>'
print '</html>'
#!/usr/bin/python有什么意义
它说要保存文件为hello.py 并保存到/var/www/cgi-bin 目录但我没有这个目录,我应该创建一个吗?
在运行您的 CGI 程序之前,请确保您已使用 chmod 755 hello.py UNIX 命令更改文件模式以使文件可执行。
但是在哪里(如何)执行这个chmod 命令?我应该在hello.py 中包含$chmod 755 "/location of hello(.py).../" 吗?
【问题讨论】:
-
请使用更好的问题标题;大多数问题都要求解释一些事情。
-
在 2014 年学习如何编写 CGI 脚本有点傻。使用 WSGI 框架。
-
很抱歉像个菜鸟一样问..我正在学习编码作为爱好..会提高自己..感谢建议 wsgi 框架..会研究它..谢谢
标签: python python-2.7 cgi chmod