[Django]-Exclude .env directory from flake8 tests?

11👍

✅

I notice your .flake8 file is inside app folder. I presume you are starting flake8 from outside the app folder, in other words from the project root.

Move .flake8 to the project root, and everything’s gonna work:

mv app/.flake8 .

30👍

Remove the commas. Lists in these .ini files are simply multi-line lists:

[flake8]
exclude =
    migrations
    __pycache__
    manage.py
    settings.py
    env
    .env

7👍

It’s also possible to exclude via --exclude flag of the cli.

 --exclude patterns    Comma-separated list of files or directories to
                    exclude. (Default: ['.svn', 'CVS', '.bzr', '.hg',
                    '.git', '__pycache__', '.tox', '.eggs', '*.egg'])

note that here it is a comma-separated list, unlike in the flake8 config file

0👍

flake8 --exclude venv --ignore=E501,F401

example exclude folder venv and ignore errors

Leave a comment