Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run django development server at startup?

Tags:

python

django

I added following command to Sessions -> Startup program but it didn't work. I'm using Ubuntu.

sudo -u www-data python manage.py 192.168.1.2:8001

192.168.1.2 is the ip address on ath0. Is it still not available for binding at the stage when this command is executed?

What I currently do is add another cronjob to restart the development server if it's not running every 5 minutes? Is it a better way to run it at startup?

like image 968
jack Avatar asked Dec 30 '22 12:12

jack


1 Answers

Hopefully you're not trying to run the server in a production environment (according to the django docs). Take a look instead at apache with mod_wsgi.

If you are just running for local development, there is no need to run as the www-data user. You might want to look into the @reboot directive for cron, and just run the server as your user.

See this answer for details on runserver.

like image 160
John Paulett Avatar answered Jan 16 '23 09:01

John Paulett