0

나는 첫 번째 프로젝트에 병 치료법을 적용하는 과정에 있습니다. 모든 것이 내 개발 서버 (windows)에서 잘 작동하지만 heroku에는 몇 가지 문제가 있습니다. 나는 나를 위해 통합 작업을 다룬 django-dynamic-scraper를 사용하고있다. 창에heroku와 django-dynamic-scraper에서 셀러 리를 scrapy 서버로 작업하는 방법은 무엇입니까?

내가 별도의 명령에서 다음 명령 프롬프트를 실행합니다

: heroku bash >heroku run scrappy server (solves app not found issue) 
: heroku run python manage.py celeryd -l info -B --settings=myapp.production 

실제 dejango 응용 프로그램에 오류 또는 문제가 없으며 내가 액세스 할 수 있습니다에게 Heroku에

: scrapy server 
: python manage.py celeryd -l info 
: python manage.py celerybeat 

내가 다음 실행 관리 웹 사이트. 단편 서버가 실행 :

: Scrapyd web console available at http://0.0.0.0:6800/ 
: [Launcher] Scrapyd started: max_proc=16, runner='scrapyd.runner' 
: Site starting on 6800 
: Starting factory <twisted.web.server.Site instanceat 0x7f1511f62ab8> 

셀러리 비트와 노동자는 작업 :

: INFO/Beat] beat: Starting... 
: INFO/Beat] Writing entries... 
: INFO/MainProcess] Connected to django://guest:**@localhost:5672// 
: WARNING/MainProcess] [email protected] ready. 
: INFO/Beat] Writing entries... 
: INFO/Beat] Writing entries... 

첫 번째 문제 : 거미를 실행하는주기적인 작업은 내가 셀러리 로그에 다음과 같은 오류가 발생하면 .

File "/app/.heroku/python/lib/python2.7/site-packages/dynamic_scraper/utils/ta 
    sk_utils.py", line 31, in _pending_jobs 
     resp = urllib2.urlopen('http://localhost:6800/listjobs.json?project=default') 
    ... 
    ... 

    File "/app/.heroku/python/lib/python2.7/urllib2.py", line 1184, in do_open 
     raise URLError(err) 
    URLError: <urlopen error [Errno 111] Connection refused> 

은 그래서 어떤 이유로 Heroku가 셀러리는 scrapy 서버에 액세스 할 수없는 것 같다.

scrapy.cfg

[settings] 
default = myapp.scraper.scrape.settings 

[deploy] 
#url = http://localhost:6800/ 
project = myapp 

셀러리 설정 미리

[config] 
    app:   default:0x7fd4983f6310 (djcelery.loaders.DjangoL 
    transport: django://guest:**@localhost:5672// 
    results:  database 
    concurrency: 4 (prefork) 
[queues] 
    celery  exchange=celery(direct) key=celery 

감사하고 당신이 어떤 더 많은 정보가 필요하면 알려주세요 :

여기 내 설정의 일부입니다.

답변

1

답변 : 동일한 호스트에서 웹 응용 프로그램, 셀러리 및 치료 서버를 실행할 수 없으며 서로 이야기 할 수 있습니다. 그러나 heroku를 사용하여이 설정을 수행하는 데는 두 가지 방법이 있습니다.

옵션 1 :

  1. 사용 scrapy-heroku는 "myapp-scrapy.herokuapp.com"라는 호스트에 scrapy 서버를 배포합니다.
  2. 그런 다음 django-scrapy 앱을 "myapp.herokuapp.com"이라는 다른 호스트에 배포하십시오.
  3. django-dynamic-scraper에서 task_utls.py를 열고 localhost:6800의 모든 어커런스를 myapp-scrapy.herokuapp.com으로 변경하십시오.

옵션 2 :

  1. 는 간단히 명령 줄에서와 마찬가지로 수동으로 스크레이퍼를 호출 할 Heroku가의 스케줄러를 사용합니다. 모든 동적 스케줄링 기능을 우회 할 것이지만 일부 유스 케이스의 경우에는 괜찮습니다.

누군가가 고통을 덜어주기를 바랍니다.

관련 문제