Вопрос

I am new in Python, I need to run my rails project which depends on Python app. I am using Python with Mysql and try to run the server but it throws an error:

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
Это было полезно?

Решение

twil is right - you need a different port for each python app. If you're on linux as root run this command (it will tell you the other python app are runninng)

ps -ef | grep python

Find the port these apps are running as and choose a different port. You could have other non python apps using that port. In that case you should look what's using the port...

https://www.centos.org/docs/5/html/5.1/Deployment_Guide/s1-server-ports.html

Hope this helps!

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top