简体   繁体   中英

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. 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.

First you need to have a clear idea what a virtual environment does.

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,

  1. Managing project packages is easier
  2. Resolving package version issues is much easier

Moreover, you should maintain a proper requirements.txt file when working with virtual environements because a single package might crash your entire code base. In that case you can totally delete the virtual environment and again start fresh.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM