开发者

How to run django development server at startup?

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 a开发者_Go百科nother cronjob to restart the development server if it's not running every 5 minutes? Is it a better way to run it at startup?


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.


Mmmm... shouldn't it be?

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


If you want the dev server to always run, you're probably better off setting up a real server on your local machine. It doesn't have to be something fat or big. I use cherokee server. Another options is lighttpd

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜