Project-wide configuration
Configure behavior shared by all spiders in a project.
Scrapy · Module
Scrapy settings are a shared key-value configuration namespace for the framework and its components. Projects normally define common settings in settings.py, with the active module selected through SCRAPY_SETTINGS_MODULE.
Scrapy settings provide a shared key-value configuration namespace used by the framework, extensions, pipelines, and spiders. A project normally stores its common configuration in settings.py, while the active project settings module can be selected with SCRAPY_SETTINGS_MODULE.
SCRAPY_SETTINGS_MODULE=myproject.settingsimport os
from scrapy.crawler import CrawlerProcess
os.environ["SCRAPY_SETTINGS_MODULE"] = "myproject.settings"
process = CrawlerProcess()
process.crawl("quotes")
process.start()Selects a project settings module through the environment and starts a crawler process using those settings.
Configure behavior shared by all spiders in a project.
Choose which Scrapy project configuration to load.
Override configuration for one execution without editing project files.
Settings are a global key-value mapping used to configure Scrapy components. A project usually places shared values in its settings.py module, and SCRAPY_SETTINGS_MODULE identifies which project settings module is active.
Follow-up: How do conflicting setting sources resolve? Command-line settings have the highest precedence, followed by spider, project, add-on, command-specific default, and global default settings.
The environment variable selects the active settings module using Python import syntax, for example myproject.settings. That module must be available on Python's import search path.
Follow-up: What would you check if selection fails? Verify both the dotted module name and that the project is importable from the current Python path.
Settings are populated through several mechanisms with defined precedence. Command-line values override spider, project, add-on, command-specific default, and global default values.
Follow-up: Why does this matter operationally? A command-line override can change runtime behavior without editing the project's settings.py file.
SCRAPY_SETTINGS_MODULEscrapy.crawler.Crawler.settingssettings.pyscrapy.settings.default_settings