我是Python的新手,我需要运行依赖于Python应用程序的rails项目。 我正在使用Python与Mysql并尝试运行服务器但它会引发错误:
17:41:41 affiliates.1 | /home/jayashri/homebrew/izea-exchange-master/affiliates/plugins/antipool.py:477: UserWarning: Warning: Your DBAPI module '<module 'MySQLdb' from '/usr/local/lib/python2.7/dist-packages/MySQL_python-1.2.4b4-py2.7-linux-x86_64.egg/MySQLdb/__init__.pyc'>' does not support sharing connections between threads.
17:41:41 affiliates.1 | "connections between threads." % str(dbapi))
17:41:41 affiliates.1 | [15/Jan/2014:17:41:41] ENGINE Listening for SIGHUP.
17:41:41 affiliates.1 | [15/Jan/2014:17:41:41] ENGINE Listening for SIGTERM.
17:41:41 affiliates.1 | [15/Jan/2014:17:41:41] ENGINE Listening for SIGUSR1.
17:41:41 affiliates.1 | [15/Jan/2014:17:41:41] ENGINE Bus STARTING
17:41:41 affiliates.1 | [15/Jan/2014:17:41:41] ENGINE PID 22407 written to './affiliates_dev.pid'.
17:41:41 affiliates.1 | [15/Jan/2014:17:41:41] ENGINE Started monitor thread '_TimeoutMonitor'.
17:41:41 affiliates.1 | [15/Jan/2014:17:41:41] ENGINE Started monitor thread 'Autoreloader'.
17:41:42 lucre.1 | => Booting WEBrick
17:41:42 lucre.1 | => Rails 2.3.15 application starting
17:41:46 affiliates.1 | [15/Jan/2014:17:41:46] ENGINE Error in 'start' listener <bound method Server.start of <cherrypy._cpserver.Server object at 0x1470f50>>
17:41:46 affiliates.1 | Traceback (most recent call last):
17:41:46 affiliates.1 | File "/usr/local/lib/python2.7/dist-packages/CherryPy-3.1.2-py2.7.egg/cherrypy/process/wspbus.py", line 147, in publish
17:41:46 affiliates.1 | output.append(listener(*args, **kwargs))
17:41:46 affiliates.1 | File "/usr/local/lib/python2.7/dist-packages/CherryPy-3.1.2-py2.7.egg/cherrypy/_cpserver.py", line 90, in start
17:41:46 affiliates.1 | ServerAdapter.start(self)
17:41:46 affiliates.1 | File "/usr/local/lib/python2.7/dist-packages/CherryPy-3.1.2-py2.7.egg/cherrypy/process/servers.py", line 53, in start
17:41:46 affiliates.1 | wait_for_free_port(*self.bind_addr)
17:41:46 affiliates.1 | File "/usr/local/lib/python2.7/dist-packages/CherryPy-3.1.2-py2.7.egg/cherrypy/process/servers.py", line 251, in wait_for_free_port
17:41:46 affiliates.1 | raise IOError("Port %r not free on %r" % (port, host))
17:41:46 affiliates.1 | IOError: Port 7180 not free on '0.0.0.0'
17:41:46 affiliates.1 |
17:41:46 affiliates.1 | [15/Jan/2014:17:41:46] ENGINE Shutting down due to error in start listener:
17:41:46 affiliates.1 | Traceback (most recent call last):
17:41:46 affiliates.1 | File "/usr/local/lib/python2.7/dist-packages/CherryPy-3.1.2-py2.7.egg/cherrypy/process/wspbus.py", line 184, in start
答案 0 :(得分:0)
twil是对的 - 你需要为每个python应用程序使用不同的端口。如果你是root用户运行这个命令(它会告诉你其他python应用程序是runninng)
ps -ef | grep python
找到这些应用运行的端口,然后选择其他端口。您可以使用该端口使用其他非python应用程序。在这种情况下,你应该看看使用端口...
https://www.centos.org/docs/5/html/5.1/Deployment_Guide/s1-server-ports.html
希望这有帮助!