Python Forum
Virtualenv with auto restart
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Virtualenv with auto restart
#1
Is there any way to leave virtualenv in autorestart mode so that you don't have to use the (deactivate) and (activate) command to restart it ?
Reply
#2
It would be the chore of your IDE to do this.

Using VSCode, If you have selected your virtual environment as the python interpreter (ctrl-shift-P --> python:select interpreter), then whenever you select new terminal from menu, it will open with the virtual environment active.

However If I close a folder that has a terminal window in which the virtual environment has been activated, exit VSCode, and then re-start, the terminal window appears, but not with virtual environment activated. I haven't been able to figure this one out.
Reply
#3
(Apr-16-2021, 08:38 PM)Larz60+ Wrote: It would be the chore of your IDE to do this.

Using VSCode, If you have selected your virtual environment as the python interpreter (ctrl-shift-P --> python:select interpreter), then whenever you select new terminal from menu, it will open with the virtual environment active.

However If I close a folder that has a terminal window in which the virtual environment has been activated, exit VSCode, and then re-start, the terminal window appears, but not with virtual environment activated. I haven't been able to figure this one out.

What I really need after deploying the application to the server is to leave virtualenv always activate (running) because as soon as I exit and close the terminal, virtualenv ends the session leaving virtualenv (off) and the application stops working ?
Reply
#4
Is it the best solution to use a virtual environment? You could run the app in a Docker container to achieve isolation.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  send email after restart raspberry pi chano 6 4,458 Jun-12-2019, 08:08 AM
Last Post: chano

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020