2014-10-03 79 views
1

我是scrapyd的新手, 我已將以下代碼插入到scrapy.cfg文件中。項目未在scrapyd中顯示

[settings] 
default = uk.settings 


[deploy:scrapyd] 
url = http://localhost:6800/ 
project=ukmall 

[deploy:scrapyd2] 
url = http://scrapyd.mydomain.com/api/scrapyd/ 
username = john 
password = secret 

如果我運行下面的代碼代碼

$scrapyd-deploy -l 

我能得到

scrapyd2    http://scrapyd.mydomain.com/api/scrapyd/ 

scrapyd    http://localst:6800/ 

要查看所有可用的項目

scrapyd-deploy -L scrapyd 

但它說明不了什麼在我的機器?

編號:http://scrapyd.readthedocs.org/en/latest/deploy.html#deploying-a-project

如果難道

$ scrapy deploy scrapyd2 
[email protected]:~/ScrapyProject/mall_uk$ scrapy deploy scrapyd2 
Packing version 1412322816 
Traceback (most recent call last): 
    File "/usr/bin/scrapy", line 4, in <module> 
    execute() 
    File "/usr/lib/pymodules/python2.7/scrapy/cmdline.py", line 142, in execute 
    _run_print_help(parser, _run_command, cmd, args, opts) 
    File "/usr/lib/pymodules/python2.7/scrapy/cmdline.py", line 88, in _run_print_help 
    func(*a, **kw) 
    File "/usr/lib/pymodules/python2.7/scrapy/cmdline.py", line 149, in _run_command 
    cmd.run(args, opts) 
    File "/usr/lib/pymodules/python2.7/scrapy/commands/deploy.py", line 103, in run 
    egg, tmpdir = _build_egg() 
    File "/usr/lib/pymodules/python2.7/scrapy/commands/deploy.py", line 228, in _build_egg 
    retry_on_eintr(check_call, [sys.executable, 'setup.py', 'clean', '-a', 'bdist_egg', '-d', d], stdout=o, stderr=e) 
    File "/usr/lib/pymodules/python2.7/scrapy/utils/python.py", line 276, in retry_on_eintr 
    return function(*args, **kw) 
    File "/usr/lib/python2.7/subprocess.py", line 540, in check_call 
    raise CalledProcessError(retcode, cmd) 
subprocess.CalledProcessError: Command '['/usr/bin/python', 'setup.py', 'clean', '-a', 'bdist_egg', '-d', '/tmp/scrapydeploy-VLM6W7']' returned non-zero exit status 1 
[email protected]:~/ScrapyProject/mall_uk$ 

如果我這樣做的另一個項目是指它顯示。

$ scrapy deploy scrapyd 
Packing version 1412325181 
Deploying to project "project2" in http://localhost:6800/addversion.json 
Server response (200): 
{"status": "error", "message": "[Errno 13] Permission denied: 'eggs'"} 
+0

你有沒有真的部署任何東西到你的本地scrapyd呢? – dataisbeautiful 2014-10-03 07:38:55

+0

我不知道,請告訴我如何部署 – 2014-10-03 07:44:55

+0

我只是在引用文檔並執行相同的操作(http://scrapyd.readthedocs.org/en/latest/deploy.html#deploying-a-project)。但我有一個scrapy項目。 – 2014-10-03 07:46:19

回答

0

您將只能列出已部署的蜘蛛。如果你還沒有部署任何事情,然後部署你的蜘蛛,你只需使用scrapy部署:

scrapy deploy [ <target:project> | -l <target> | -L ] 

[email protected]:~/takeovertheworld$ scrapy deploy scrapyd2 
Packing version 1410145736 
Deploying to project "takeovertheworld" in http://ec2-xx-xxx-xx-xxx.compute-1.amazonaws.com:6800/addversion.json 
Server response (200): 
{"status": "ok", "project": "takeovertheworld", "version": "1410145736", "spiders": 1} 

驗證通過訪問scrapyd API,該項目已正確安裝:

[email protected]:~/takeovertheworld$ curl http://ec2-xx-xxx-xx-xxx.compute-1.amazonaws.com:6800/listprojects.json 
{"status": "ok", "projects": ["takeovertheworld"]} 
+0

這是運行上述命令之後拋出的錯誤subprocess.CalledProcessError:命令'['/ usr/bin/python','setup.py','clean','-a','bdist_egg','-d' ,'/ tmp/scrapydeploy-VLM6W7']'返回的非零退出狀態1 – 2014-10-03 07:54:15

+0

我需要清理setup.py並正確地輸入egg?如果是,請告訴如何做到這一點? – 2014-10-03 07:56:44

+0

你可以在你的問題中發佈完整的跟蹤嗎? – dataisbeautiful 2014-10-03 07:57:37

0

我有同樣的錯誤太。正如@ hugsbrugs所說,因爲scrapy項目中的一個文件夾具有root權限。所以,我這樣做。

sudo scrapy deploy scrapyd2