OSX 10.7.3, PyCharm version 2.5 build PY 117.200
I\'ll run through how I get the error:
Basically the reason this occurs is that PyCharm doesn't, by default, have access to environmental variables.
I've found 3 solutions to this problem:
Set a global environmental variable, using the link CrazyCoder suggests in the comments to this question.
Run PyCharm from a terminal window by changing to the PyCharm application directory and running ./pycharm
(possibly create a symlink in your PATH to make this less inconvenient)
Open PyCharm preferences, browse to Console > Django Console
, type in your required environmental variables as you would in your bash profile e.g. LC_ALL=en_US.UTF-8
I'd suggest the 3rd way as most elegant, although it's annoying that variables aren't loaded by default.