diff --git a/docs/topics/commands.rst b/docs/topics/commands.rst index f49e4cf22..e8d99fc55 100644 --- a/docs/topics/commands.rst +++ b/docs/topics/commands.rst @@ -21,17 +21,8 @@ standalone ``scrapyd-deploy``. See `Deploying your project`_.) Configuration settings ====================== -Scrapy will look for configuration parameters in toml-style ``pyproject.toml`` -files in standard locations: - -1. ``/etc/pyproject.toml`` or ``c:\scrapy\pyproject.toml`` (system-wide), -2. ``~/.config/pyproject.toml`` (``$XDG_CONFIG_HOME``) and ``~/.pyproject.toml`` (``$HOME``) - for global (user-wide) settings, and -3. ``pyproject.toml`` inside a Scrapy project's root (see next section). - -Settings from these files are merged in the listed order of preference: -user-defined values have higher priority than system-wide defaults -and project-wide settings will override all others, when defined. +Scrapy looks for project configuration in a ``pyproject.toml`` file located in +the project root directory (see next section). Scrapy also understands, and can be configured through, a number of environment variables. Currently these are: diff --git a/tests/test_utils_conf.py b/tests/test_utils_conf.py index 9acf48c11..55a346600 100644 --- a/tests/test_utils_conf.py +++ b/tests/test_utils_conf.py @@ -59,6 +59,19 @@ def test_arglist_to_dict(): class TestPyprojectToml: + def test_multiple_projects(self, tmp_path, monkeypatch): + (tmp_path / "pyproject.toml").write_text( + "[tool.scrapy.settings]\n" + 'default = "myproject1.settings"\n' + 'project1 = "myproject1.settings"\n' + 'project2 = "myproject2.settings"\n' + ) + monkeypatch.chdir(tmp_path) + cfg = get_config() + assert cfg.get("settings", "default") == "myproject1.settings" + assert cfg.get("settings", "project1") == "myproject1.settings" + assert cfg.get("settings", "project2") == "myproject2.settings" + def test_pyproject_toml_takes_precedence_over_scrapy_cfg( self, tmp_path, monkeypatch ):