Setting DJANGO_SETTINGS_MODULE under virtualenv?

白昼怎懂夜的黑 提交于 2019-12-02 23:31:49

You were on the right track, but you want to use the postactivate hook instead of postmkvirtualenv.

It won't restore automatically on deactivate. Thankfully there is postdeactivate hook that you can use to manually restore any environmental variables that you changed on activate.

One way I've done that before is by appending an export statement to the end of ./bin/activate

export DJANGO_SETTINGS_MODULE="myproject.settings"
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!