다른 컴퓨터에서 내 CherryPy 사이트에 액세스하고 싶습니다만 답변 양식 here과 here을 사용해 보았지만 어느 것도 작동하지 않았습니다. 나는 OSX El Capitan, Python 3.5.2와 함께 Mac을 사용하고 있으며 CherryPy의 최신 버전이라고 믿습니다. 이것은 현재 코드입니다. 주소가 무엇인지 신경 쓰지 않고 그냥 작동합니다. 어떤 도움을 주셔서 감사합니다!Python 3 (CherryPy) 서버가 다른 컴퓨터에서 작동하지 않습니다.
import cherrypy
class HelloWorld(object):
def index(self):
return "Hello World!"
index.exposed = True
# bind to all IPv4 interfaces
cherrypy.config.update({'server.socket_host': '0.0.0.0'})
cherrypy.quickstart(HelloWorld())
편집 :
내가 localhost:8080
127.0.0.1
및 0.0.0.0
에서 사이트에 액세스 할 수 있습니다. 콘솔 출력은 다음과 같습니다.
[26/Jul/2016:19:10:26] ENGINE Listening for SIGTERM.
[26/Jul/2016:19:10:26] ENGINE Listening for SIGHUP.
[26/Jul/2016:19:10:26] ENGINE Listening for SIGUSR1.
[26/Jul/2016:19:10:27] ENGINE Bus STARTING
Warning (from warnings module):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/cherrypy/_cpchecker.py", line 105
warnings.warn(msg)
UserWarning: The Application mounted at '' has an empty config.
[26/Jul/2016:19:10:27] ENGINE Started monitor thread '_TimeoutMonitor'.
[26/Jul/2016:19:10:27] ENGINE Started monitor thread 'Autoreloader'.
[26/Jul/2016:19:10:27] ENGINE Serving on http://0.0.0.0:8080
[26/Jul/2016:19:10:27] ENGINE Bus STARTED
IDLE을 사용하여 파일을 실행하며 방화벽을 사용하지 않습니다.
1) localhost에서 사용할 수 있습니까? 2) 실제로 일부 TCP 포트에 바인딩됩니까? 콘솔 출력은 무엇입니까? 3) Mac에 방화벽이 설정되어 있습니까? 4) 앱에 어떻게 액세스하려고합니까? – webKnjaZ
다른 컴퓨터의 IP 주소를 제외하고 시도한 모든 것을 언급했습니다. –
@webKnjaZ 질문에 답하기 위해 내 질문을 편집하려고했습니다. TCP 포트가 무엇인지, 또는 바인딩이 무엇인지 확실하지 않습니다. 설명 할 수 있습니까? – nedla2004