mirror of https://github.com/scrapy/scrapy.git
scrapyd: support bind to a specific ip address
This commit is contained in:
parent
81abb45000
commit
5afe4f50c1
|
|
@ -153,6 +153,11 @@ http_port
|
|||
|
||||
The TCP port where the HTTP JSON API will listen. Defaults to ``6800``.
|
||||
|
||||
bind_address
|
||||
------------
|
||||
|
||||
The IP address where the HTTP JSON API will listen. Defaults to ``0.0.0.0`` (all)
|
||||
|
||||
max_proc
|
||||
--------
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ from .config import Config
|
|||
def application(config):
|
||||
app = Application("Scrapyd")
|
||||
http_port = config.getint('http_port', 6800)
|
||||
bind_address = config.get('bind_address', '0.0.0.0')
|
||||
|
||||
poller = QueuePoller(config)
|
||||
eggstorage = FilesystemEggStorage(config)
|
||||
|
|
@ -28,8 +29,8 @@ def application(config):
|
|||
|
||||
launcher = Launcher(config, app)
|
||||
timer = TimerService(5, poller.poll)
|
||||
webservice = TCPServer(http_port, server.Site(Root(config, app)))
|
||||
log.msg("Scrapyd web console available at http://localhost:%s/" % http_port)
|
||||
webservice = TCPServer(http_port, server.Site(Root(config, app)), interface=bind_address)
|
||||
log.msg("Scrapyd web console available at http://%s:%s/" % (bind_address, http_port))
|
||||
|
||||
launcher.setServiceParent(app)
|
||||
timer.setServiceParent(app)
|
||||
|
|
|
|||
Loading…
Reference in New Issue