Python 在Cherrypy配置中打开端口
这是我的密码,但我知道Python 在Cherrypy配置中打开端口,python,cherrypy,Python,Cherrypy,这是我的密码,但我知道 #!/usr/bin/python import cherrypy cherrypy.config.update({'server.socket_host': "10.0.1.15",'server.socket_port': 80}) class HelloWorld(object): def index(self): return "HelloWorld" index.exposed = True cherrypy.quicks
#!/usr/bin/python
import cherrypy
cherrypy.config.update({'server.socket_host': "10.0.1.15",'server.socket_port': 80})
class HelloWorld(object):
def index(self):
return "HelloWorld"
index.exposed = True
cherrypy.quickstart(HelloWorld())
我为内部地址10.0.1.15保留了DHCP,并且在我的airport extreme设置中也为该地址打开了端口80。运行root@yoursystem#ps-ef | grep python。查看你的应用程序是否仍在以前启动时运行。该应用程序尚未运行,但我这次尝试以root用户身份运行服务器,结果成功。作为普通用户,我拥有rwx权限,因此我假设通过cherrypy更改主机/端口配置出于某种原因需要root访问权限。至少你已经走上正轨了。我使用uwsgi,它运行的用户似乎需要是它访问的文件的所有者,即chmod-R744。1024以下的端口是特权端口,因此您必须是root用户才能感谢您的回答\
[29/Jan/2014:11:16:14] ENGINE Bus STOPPING
[29/Jan/2014:11:16:14] ENGINE HTTP Server
cherrypy._cpwsgi_server.CPWSGIServer(('10.0.1.15', 80)) already shut down
[29/Jan/2014:11:16:14] ENGINE Stopped thread '_TimeoutMonitor'.
[29/Jan/2014:11:16:14] ENGINE Stopped thread 'Autoreloader'.
[29/Jan/2014:11:16:14] ENGINE Bus STOPPED
[29/Jan/2014:11:16:14] ENGINE Bus EXITING
[29/Jan/2014:11:16:14] ENGINE Bus EXITED