2

I have a Django project running in a virtualenv and I would like the terminal to run in that virtualenv when opened. At the moment I have to type workon virtualenv which isn't exactly the end of the world but I'm guessing there is a way to make this happen automatically? Is there a way to run commands at startup like you can do with the django and python consoles?

eggbert
  • 2,835
  • 5
  • 27
  • 34

1 Answers1

2

As tttthomasssss suggested, the answer is here: https://stackoverflow.com/a/22289136/519074. Only this answer worked, the ones below it didn't even though they look more useful.

Update - This is what worked for me:

For each virtualenv, put a file called something like terminalactivate.sh into /bin with this:

#!/bin/sh
source ~/.bashrc
source $(cd `dirname "${BASH_SOURCE[0]}"` && pwd)/activate

Then in pycharm/idea settings choose this for shell path:

/bin/bash --rcfile ~/virtualenv/sff/bin/terminalactivate.sh
Community
  • 1
  • 1
eggbert
  • 2,835
  • 5
  • 27
  • 34