I'm trying to create an automation program that setups my django project.
I was able to create the project folder and virtual environment however I'm not sure if virtual env was activated or not in that folder. I need the virtual env to activate so that I can install django. The way I run the command for now is ./auto.sh setup <poject_folder_name>
, where setup is the name of my function. Here is the inside of the function.
python3 setup.py $2
cd $FILEPATH/$2
echo $FILEPATH/$2
virtualenv env
source env/bin/activate
cd ~/scripts
python3 checker.py
The last two lines in the above code is my attempt in checking if the virtual env was activated in that folder and I always get the FAILED
output. This is what checker.py
contains.
import sys
if hasattr(sys, 'real_prefix'):
print('\nOK\n')
else:
print('\nFAILED\n')
I'm really new to bash scripting and any help is greatly appreciated.
[EDIT] FILEPATH was set in my .bash_profile to the directory where I want the new folder to be created.