This is a quite lengthy post, but after doing extensive research I couldn't find a solution. I have a mixed Django 1.4.1 / Scrapy 0.14.4 project on OSX 10.8 and I control Scrapy with the Django project's manage.py command as described here. For instance, calling
python manage.py scrapy crawl example_spider
works without a problem. Now I'm at the point where I want to setup the scrapyd web service to deploy my spiders. However, when I execute
python manage.py scrapy server
then I get this exception:
scrapy.exceptions.NotConfigured: Unable to find scrapy.cfg file to infer project data dir
So, apparently Scrapy cannot find the scrapy.cfg file because I don't execute it from within the Scrapy project. The other Scrapy commands work, however, because in my Django project's settings.py I did the following:
sys.path.append('/absolute/path/to/my/Scrapy/project')
os.environ['SCRAPY_SETTINGS_MODULE'] = 'my_scrapy_project_name.settings'
Question 1: Why can't Scrapy detect the scrapy.cfg file in my setup? How can I resolve this?
Since the stuff mentioned above doesn't work, I tried to get the scrapyd server running using just the scrapy command from within my Scrapy project directory. Executing scrapy server from the top-level directory of my Scrapy project yields the following:
$ scrapy server
UserWarning: Cannot import scrapy settings module my_scrapy_project_name.settings
warnings.warn("Cannot import scrapy settings module %s" % scrapy_module)
2012-08-31 21:58:31+0200 [-] Log opened.
2012-08-31 21:58:32+0200 [-] Scrapyd web console available at http://localhost:6800/
2012-08-31 21:58:32+0200 [Launcher] Scrapyd started: max_proc=8,