Setup django environment

Whenever I want to work with django, I have to do the following 6 steps to setup my environment. I probably don’t need to “conda deactivate” but I didn’t want to see “(base)” in the command line…and it isn’t necessary for this project. It becomes tedious everytime.

  • cd Mystuff/Python3/django/
  • conda deactivate
  • source bin/activate
  • cd password_generator-project/
  • code .
  • python manage.py runserver

Seemed like a easy thing for a bash script, except…

you can’t “deactivate conda” in the shell script
you can’t “source bin/activate”in the shell script
after the script finishes I’m no longer in the ‘cd’ directory

I couldn’t do it in Python either!

Perhaps there is some quirky way to do it but I wasted enough time googling and trying. For me it turns out the easiest way to do it was to put the commands in a text file then copy&paste those commands on the command line!