Skip to content

Commit ac40b80

Browse files
aleksanbmkurnikov
authored andcommitted
Mention solution to potential PYTHONPATH pitfall. (#115)
1 parent 6b21a04 commit ac40b80

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ django_settings_module = mysettings
4242
```
4343
where `mysettings` is a value of `DJANGO_SETTINGS_MODULE` (with or without quotes)
4444

45+
Do you have trouble with mypy / the django plugin not finding your settings module? Try adding the root path of your project to your PYTHONPATH environment variable. If you use pipenv you can add the following to an `.env` file in your project root which pipenv will run automatically before executing any commands.:
46+
```
47+
PYTHONPATH=${PYTHONPATH}:${PWD}
48+
```
49+
4550
New implementation uses Django runtime to extract models information, so it will crash, if your installed apps `models.py` is not correct. For this same reason, you cannot use `reveal_type` inside global scope of any Python file that will be executed for `django.setup()`.
4651

4752
In other words, if your `manage.py runserver` crashes, mypy will crash too.
@@ -63,4 +68,4 @@ Otherwise, custom type will be created in mypy, named `MyUser__MyUserManager`, w
6368

6469
We have Gitter here https://gitter.im/mypy-django/Lobby.
6570

66-
If you think you have more generic typing issue, please refer to https://github.com/python/mypy and their Gitter.
71+
If you think you have more generic typing issue, please refer to https://github.com/python/mypy and their Gitter.

0 commit comments

Comments
 (0)