[英]Django: Does the virtual environment have to be on every time i develop my django app
i have installed and set up the virtual environment using the command line.我已经使用命令行安装并设置了虚拟环境。 i am using pycharm to develop my django application.
我正在使用 pycharm 来开发我的 django 应用程序。 so that was day 1. On day 2 when i put my laptop back on to go back to working on my django application do i need to go back to command line and type in workon 'virtualenvironment-name' or can i just develop the django app without switching on the virtual environment.
so that was day 1. On day 2 when i put my laptop back on to go back to working on my django application do i need to go back to command line and type in workon 'virtualenvironment-name' or can i just develop the django应用程序无需打开虚拟环境。
First you need to have a clear idea what a virtual environment
does.首先,您需要清楚地了解
virtual environment
的作用。
The one and only thing virtual enviornment does is it isolates projects dependencies.虚拟环境所做的唯一一件事就是隔离项目的依赖关系。 You can definitely work without virtual environment.
您绝对可以在没有虚拟环境的情况下工作。 All you need to do is just install the libraries globally.
您需要做的只是全局安装这些库。 That's it.
而已。
EDIT编辑
Installing packages globally is not recomended because when you use virtual environment,不推荐全局安装包,因为当你使用虚拟环境时,
Moreover, you should maintain a proper requirements.txt
file when working with virtual environements because a single package might crash your entire code base.此外,在使用虚拟环境时,您应该维护一个适当的
requirements.txt
文件,因为单个 package 可能会使您的整个代码库崩溃。 In that case you can totally delete the virtual environment and again start fresh.在这种情况下,您可以完全删除虚拟环境并重新开始。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.