3đź‘Ť
What are looking for is something like Gunicorn, because runserver is only for development purposes. This is detailed tutorial for you to use
1đź‘Ť
You can’t “run manage.py runserver from outside of virtual environment” if your project relies on a virtual environment… But nothing prevents you from writing a wrapper bash script that cd into your project’s root, activate the virtualenv and launch the dev server.
This being said, I really don’t see the point – and I even see a couple reasons to not do so, the first one being that you definitly want to keep the terminal where you run your dev server from opened so you can read all the logs in real time.
0đź‘Ť
That’s easy in Ubuntu you just need to create a shell script and run it from it’s folder in the terminal as : ./shellscriptname.sh
but for that first you need to create the shell script by writing the same commands used on terminal to run the django server.
Example:
echo Hello Sangeeth
echo Lets start the app
cd myapp
cd venv
source bin/activate
cd ..
cd myapp
python manage.py runserver
even though this method helps you run the app , you wont be seeing the actual folder access and virtual environment on the terminal.