Often requirements show up in requirements.txt
like this:
django-registration
But in INSTALLED_APPS
it appears as registration
. So when you import like:
from registration.signals import user_registered
This is valid but PyCharm is showing a red squiggly line under the word registration in from registration...
that says "Package 'registration' is not listed in project requirements".
How can I remedy this?
UPDATE
I was able to find a way to make the warning go away but it's not a good solution. If you simply add the package name to the requirements.txt
file the warning goes away, but then that requirement is not valid if you were to install with pip
. For example, I'm also using pygooglevoice
which is how it's written in requirements.txt
but when it's imported in the code, you write:
from googlevoice import Voice
This seems weird because I use PyCharm for many projects and I'm just noticing this with a recent project I'm working on...
To enable Django support, follow these steps: Open the project Settings/Preferences dialog ( Ctrl+Alt+S ) and navigate to the Languages & Frameworks | Django page. Make sure that the checkbox Enable Django support is selected. Apply changes (if any) and close the dialog.
If you cannot print the Django version from the python console in Pycharm, go to settings>Project:project_name>project Interpreter and from the list of installed packages see the installed Django and it's version for that project.
One of the features of PyCharm is that it includes a support for Django. With the ability of including JavaScript features within PyCharm, it can be considered as the best IDE for Django.
If you are using virtual environment for every new project then you need to install django each time. Other wise you can use single virtual environment for all the project.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With