mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-06 12:14:28 +08:00
Mention solution to potential PYTHONPATH pitfall. (#115)
This commit is contained in:
committed by
Maxim Kurnikov
parent
6b21a0476d
commit
ac40b80764
@@ -42,6 +42,11 @@ django_settings_module = mysettings
|
||||
```
|
||||
where `mysettings` is a value of `DJANGO_SETTINGS_MODULE` (with or without quotes)
|
||||
|
||||
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.:
|
||||
```
|
||||
PYTHONPATH=${PYTHONPATH}:${PWD}
|
||||
```
|
||||
|
||||
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()`.
|
||||
|
||||
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
|
||||
|
||||
We have Gitter here https://gitter.im/mypy-django/Lobby.
|
||||
|
||||
If you think you have more generic typing issue, please refer to https://github.com/python/mypy and their Gitter.
|
||||
If you think you have more generic typing issue, please refer to https://github.com/python/mypy and their Gitter.
|
||||
|
||||
Reference in New Issue
Block a user