2

I am new to Django. I have created the virtual environment. With virtualenvwrapper, there is a way to configure different hooks that are sourced before or after activating the virtual environment, and before or after deactivating it, but I am not sure how to do this. I am using Windows for this. There is a lot of help for this in Linux but I can't find anything for Windows.

Dhia
  • 10,119
  • 11
  • 58
  • 69
Dipesh
  • 49
  • 3

1 Answers1

0

Since you are using windows you should read this thread before. Once finished and decided to use tools such as powershell, you can do as follow:

in your virtualenv directory you will find your app folders, under virtualenv_path/app/bin you find all the hooks:

Example: You need to set DJANGO_SETTINGS_MODULE to tell django use my local setting, you need to set it in each activation of the env and unset it when you deactive the env:

in postactive file add : export DJANGO_SETTINGS_MODULE="myproject.settings_local"

and in predeactivate you add: unset DJANGO_SETTINGS_MODULE

So the variable will be set every time you activate your env and unset every tine you deactivate. To check if every thing is working correct when you activate your env try in shell:

echo $DJANGO_SETTINGS_MODULE
Community
  • 1
  • 1
Dhia
  • 10,119
  • 11
  • 58
  • 69
  • you still can do it if you use tools like [powershell](https://msdn.microsoft.com/en-us/powershell). I updated the post, check the link. – Dhia Dec 16 '15 at 12:20