1👍
If you are not using virtualenvwrapper, you can put it in $VIRTUAL_ENV/bin/activate
script. like
export DJANGO_SETTINGS_MODULE='foo.settings.development'
In the same script you can see a deactivate function, there you can unset the environment variable, which will be called while deactivating virtualenv
unset DJANGO_SETTINGS_MODULE
If you are using virtualenvwrapper you can set environment variable in postactivate
and unset it in postdeactivate
scripts
Source:stackexchange.com