Pycharm error Django is not importable in this environment
Yet another case, where my virtualenv did have Django installed, but Pycharm would still display this error.
I eventually found out that the same virtualenv path had been duplicated in the list of available interpreters. Removing all of them and re-adding fixed it.
The duplication happened after I copied the .idea from another machine, and re-created the virtualenv from Pycharm although it was already listed as a (broken) interpreter.
For people having selected a virtualenv/interpreter that HAS Django installed (but it might have changed python version since first selection...), and even re-installed Django, and still get this message, and slowly getting crazy:
File > Invalidate Caches / Restart ...
Also, keeping the list of available interpreters clean and correct always helps (on my linux, old interpreters of previous linux installations kept popping up...whaat), as well as not using special characters in virtualenv names (as was the OPs problem...see his answer). Messing with the .idea
folder also is not recommended (dont copy it to your new computer ;-).
In my case I had to go to Settings (Alt+F7, or the Spanner/Cog icon) and select a Python interpreter which has Django installed alongside it.
If Django isn't already installed, you should be able to install it via the + (plus) icon (not shown below) once an interpreter has been selected.
Project interpreter, which is being used in the pycharm
setting , doesn't have the django
package installed. So go to
setting->Project->project interpreter
Then install django
package
it will work :)