every time I need to start a Django server, I have to do the following:
cd to some directory
source env/bin/activate
python manage.py run_gunicorn 0.0.0.0:8000
How could I simplify this process by creating a script that would start the server once executed.
I tried to create .sh script with, but I failed to change Python environment with source command.
Then I tried to create .py file and execute commands with os.system(), but virtualenv did not seem to have been initiated.
I would do it as a shell function rather than as a script:
This should be functionally equivalent to running it at the command line.
You could put the same lines inside a shell script, in which case the ‘source’ command would be local to the shell script. That would probably be a good thing, as long as there aren’t variables that you want to keep in scope after you run the script.