Django is not importable PyCharm 2017.1

Answered

I just upgraded to PyCharm 2017.1 and prior to that Django was detected just fine. We currently use an ancient version of django for our project (1.4) that is stored in a separate directory in the project. We have in the past been able to have PyCharm pick that up by marking that directory as a sources root and having the "Add source roots to PYTHONPATH" option checked, but now all of my configurations are saying that "Django is not importable in this environment". If I click on ok and tell PyCharm to run the configuration anyway, it functions fine, but I sometimes see error notifications on my code that it cannot find django when I import a django component into the code. Does PyCharm ignore unsupported older versions of Django when setting up the configuration for a runserver?

1
5 comments
Official comment

Hello.

 

Please file issue here: https://youtrack.jetbrains.com/

Provide project to reproduce if possible.

Avatar
Permanently deleted user

I am also recently seeing this behavior after installing a different python3 app on my laptop.  Before I only had 2.7.  Do you have both installed as well?

 

1
Avatar
Permanently deleted user

Other info that might help if you see any similarities:

os: OSX El Capitan

python installed via Homebrew to usr/local/bin/python and usr/local/bin/python3

Django version 1.8.12

I tried installing pip install Django==1.8.18 with the same problem 

and I am pretty sure 1.8 is still supported

env initially created via virtualenv from a requirements.txt file

0
Avatar
Permanently deleted user

So, I rebuilt my machine taking notes to reproduce the problem and it has gone away.  I am not sure what happened but I can not duplicate it again.  I am going to assume this was something weird with my environment or permissions.

0
Avatar
Permanently deleted user

Mine was doing this, but I found out I had the virtual env set to a path that no longer existed.  Once I updated that, it went away.  

0

Please sign in to leave a comment.