20
After seeing this phenomenon again, I did some more digging. After setting certain folders as source roots and restarting PyCharm, these reference warnings went away. I think this is a bug in PyCharm.
20
JetBrains claims that this is fixed in version 2017.2:
https://youtrack.jetbrains.com/issue/PY-11963#comment=27-2248728
I can confirm this (in IntelliJ IDEA). Also, it’s worth double-checking that the correct requirements file is specified in Settings -> Tools -> Python Integrated Tools -> Package requirements file
- [Django]-Startapp with manage.py to create app in another directory
- [Django]-Detect whether Celery is Available/Running
- [Django]-Is this the right way to do dependency injection in Django?
- [Django]-Using mock to patch a celery task in Django unit tests
- [Django]-Form with CheckboxSelectMultiple doesn't validate
- [Django]-Django: list all reverse relations of a model
2
PyCharm should be able to figure this out, but it doesn’t. For now, I just add # noinspection PyPackageRequirements to each import with this warning to suppress it. I’d rather not, but it works for now.
- [Django]-Get class name of django model
- [Django]-Migrating Django fixtures?
- [Django]-How do you perform Django database migrations when using Docker-Compose?
-1
This issue can be fixed using the following commands in the terminal (using linux, not sure if this will work on windows, but I see no reason why it shouldn’t, I haven’t tried on windows.)
If you haven’t created a requirements.txt file already
touch requirements.txt
This should do the trick
pip freeze > requirements.txt
pip install flask
For better understanding, I recommend reading this
https://boscacci.medium.com/why-and-how-to-make-a-requirements-txt-f329c685181e
- [Django]-RuntimeWarning: DateTimeField received a naive datetime
- [Django]-'WSGIRequest' object has no attribute 'user' Django admin
- [Django]-Going from twitter date to Python datetime date