Bonjour,
Dans son livre Gérard Swinnen donne le fichier tutoriel.conf
et aussi:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 [global] server.socket_host = "127.0.0.1" server.socket_port = 8080 server.thread_pool = 5 tools.sessions.on = True tools.encode.encoding = "Utf-8" [/annexes] tools.staticdir.on = True tools.staticdir.dir = "annexes"
Je le lance sans problème et je peux accéder à ma page web depuis le même ordi avec http://localhost:8080
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 import cherrypy class MonSiteWeb(object): # Classe produisant des objets gestionnaires de requêtes HTTP." def index(self): return "<h1>Bonjour Ã* tous !</h1>" index.exposed = True cherrypy.quickstart(MonSiteWeb(), config ="tutoriel.conf")
Maintenant, je voudrais y accéder depuis un autre ordinateur et je n'y arrive pas.
J'ai remplacé dans le fichier tutoriel.config "127.0.0.1" par mon adresse IP et j'obitiens ce genre d'erreur:
>pythonw -u "site_web_01.py"
('cherrypy.__version__ :', '3.2.4')
('cherrypy.__file__ :', 'C:\\Python27\\lib\\site-packages\\cherrypy-3.2.4-py2.7.egg\\cherrypy\\__init__.pyc')
[16/Feb/2014:15:36:07] ENGINE Listening for SIGTERM.
[16/Feb/2014:15:36:07] ENGINE Bus STARTING
CherryPy Checker:
dir is a relative path and no root provided.
section: [/annexes]
root: None
dir: 'annexes'
[16/Feb/2014:15:36:07] ENGINE Started monitor thread '_TimeoutMonitor'.
[16/Feb/2014:15:36:07] ENGINE Started monitor thread 'Autoreloader'.
[16/Feb/2014:15:36:12] ENGINE Error in 'start' listener <bound method Server.start of <cherrypy._cpserver.Server object at 0x027098F0>>
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\cherrypy-3.2.4-py2.7.egg\cherrypy\process\wspbus.py", line 197, in publish
output.append(listener(*args, **kwargs))
File "C:\Python27\lib\site-packages\cherrypy-3.2.4-py2.7.egg\cherrypy\_cpserver.py", line 151, in start
ServerAdapter.start(self)
File "C:\Python27\lib\site-packages\cherrypy-3.2.4-py2.7.egg\cherrypy\process\servers.py", line 168, in start
wait_for_free_port(*self.bind_addr)
File "C:\Python27\lib\site-packages\cherrypy-3.2.4-py2.7.egg\cherrypy\process\servers.py", line 412, in wait_for_free_port
raise IOError("Port %r not free on %r" % (port, host))
IOError: Port 80 not free on '86.204.242.51'
[16/Feb/2014:15:36:12] ENGINE Shutting down due to error in start listener:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\cherrypy-3.2.4-py2.7.egg\cherrypy\process\wspbus.py", line 235, in start
self.publish('start')
File "C:\Python27\lib\site-packages\cherrypy-3.2.4-py2.7.egg\cherrypy\process\wspbus.py", line 215, in publish
raise exc
ChannelFailures: IOError("Port 80 not free on '86.204.242.51'",)
[16/Feb/2014:15:36:12] ENGINE Bus STOPPING
[16/Feb/2014:15:36:12] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('86.204.242.51', 80)) already shut down
[16/Feb/2014:15:36:12] ENGINE Stopped thread 'Autoreloader'.
[16/Feb/2014:15:36:12] ENGINE Stopped thread '_TimeoutMonitor'.
[16/Feb/2014:15:36:12] ENGINE Bus STOPPED
[16/Feb/2014:15:36:12] ENGINE Bus EXITING
[16/Feb/2014:15:36:12] ENGINE Bus EXITED
>Exit code: 70
S'agit t'il bien de monadresse IP que je dois mettre? (celle sur internet ou celle en local)
Je pense aussi qu'il peut s'agir d'un problème de port et que celui-ci varie régulièrement...
Avez-vous une explication?
Partager