Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_project_settings precludes configuring settings on command line #10

Closed
eshao opened this issue Aug 23, 2013 · 1 comment
Closed
Assignees
Milestone

Comments

@eshao
Copy link

eshao commented Aug 23, 2013

The way you're currently getting settings:

from scrapy.utils.project import get_project_settings

Only allows reading settings from the settings.py file. If a user wants to overwrite MONGODB_DATABASE, for example, from the command line using the -s flag, it won't register in scrapy-mongodb.

The solution would be to do something like:

class MyExtension(object):

    @classmethod
    def from_crawler(cls, crawler):
        settings = crawler.settings
        if settings['LOG_ENABLED']:
            print "log is enabled!"

Source: http://doc.scrapy.org/en/latest/topics/settings.html

@sebdah
Copy link
Owner

sebdah commented Aug 23, 2013

Thanks for the report @eshao! I have adjusted this and released version 0.6.2 to PyPI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants