1

I am attempting to run a script that opens several gnome terminal tabs and then run commands in a Pipenv environment. In order to make sure that I run the commands after ~/.bashrc, I followed the answer to this question. This seems to work without a problem. However, the issue comes when I run this command to start a Django server in a virtual environment:

BASH_POST_RC='pipenv shell && ./manage.py runserver' gnome-terminal --tab --title="My tab" 

The command results in the following:

Loading .env environment variables... Launching subshell in virtual environment... . /home/daniel/.local/share/virtualenvs/my-env/bin/activate Shell for UNKNOWN_VIRTUAL_ENVIRONMENT already activated. No action taken to avoid nested environments.

It would seem somehow that it thinks it is already in the virtual environment, which is not the case. And I'm not in the virtual environment when I run the command in the first place. Furthermore, no other commands seem to run after pipenv shell. It just does nothing.

How can I solve this?

1 Answers1

0

I discovered that Pipenv has a run command to run python scrips directly in your virtual environment. So all I did was use:

BASH_POST_RC='pipenv run python manage.py runserver' gnome-terminal --tab --title="Django server"