DJANGO_SETTINGS_MODULE
weisong82 opened this issue · 1 comments
[root@iZj6cay283146nzk0n83czZ scrapyLinkedIn]# scrapy crawl linkedin
Traceback (most recent call last):
File "/usr/local/bin/scrapy", line 11, in
sys.exit(execute())
File "/usr/local/lib/python3.4/site-packages/scrapy/cmdline.py", line 141, in execute
cmd.crawler_process = CrawlerProcess(settings)
File "/usr/local/lib/python3.4/site-packages/scrapy/crawler.py", line 238, in init
super(CrawlerProcess, self).init(settings)
File "/usr/local/lib/python3.4/site-packages/scrapy/crawler.py", line 129, in init
self.spider_loader = _get_spider_loader(settings)
File "/usr/local/lib/python3.4/site-packages/scrapy/crawler.py", line 325, in _get_spider_loader
return loader_cls.from_settings(settings.frozencopy())
File "/usr/local/lib/python3.4/site-packages/scrapy/spiderloader.py", line 33, in from_settings
return cls(settings)
File "/usr/local/lib/python3.4/site-packages/scrapy/spiderloader.py", line 20, in init
self._load_all_spiders()
File "/usr/local/lib/python3.4/site-packages/scrapy/spiderloader.py", line 29, in _load_all_spiders
self._load_spiders(module)
File "/usr/local/lib/python3.4/site-packages/scrapy/spiderloader.py", line 23, in _load_spiders
for spcls in iter_spider_classes(module):
File "/usr/local/lib/python3.4/site-packages/scrapy/utils/spider.py", line 25, in iter_spider_classes
if inspect.isclass(obj) and
File "/usr/local/lib/python3.4/inspect.py", line 83, in isclass
return isinstance(object, type)
File "/usr/local/lib/python3.4/site-packages/django/utils/functional.py", line 226, in inner
self._setup()
File "/usr/local/lib/python3.4/site-packages/django/conf/init.py", line 42, in _setup
% (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested settings, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
The project doesn't use Django. You should create its virtual environment and activate it. Maybe you are using another virtual env.
Follow this tutorial:
http://python-guide-pt-br.readthedocs.io/en/latest/dev/virtualenvs/