How to start Django as a service?

I find it hard to run Django on my Ubuntu server. I can start Django, but I do not know how to start it as a service.

Distributor ID:    Ubuntu
Description:       Ubuntu 10.10
Release:           10.10
Codename:          maverick

That's what I'm doing:

  • I sign up to my Ubuntu server
  • Run the Django process: sudo ./manage.py runserver 0.0.0.0:80 &
  • Test: traffic passes and the application displays the correct page.
  • Now I close the terminal window and everything stops. I think I need to somehow start it as a service, but I can’t figure out how to do it.

How to save a Django process on port 80, even if I'm not registered?

In addition, I understand that I must link it through Apache, but not yet ready.

+3
source share
5 answers

manage.py runserver 80. . , 8000 80 iptables, django root.

django ( ) , -.

- , &, , , , ( ) .

, setsid. . setsid.

+13

, manage.py, "nohup" :

sudo nohup /home/ubuntu/django_projects/myproject/manage.py runserver 0.0.0.0:80 &
+8

, Ubuntu, awesome Ubuntu upstart.

, . django-fcgi, Django FastCGI:

/etc/init/django-fcgi.conf

.

runserver :

start runserver

stop runserver

Django Upstart: . .

+3

, & , . , , , .

gunicorn apache mod_wsgi. django , .

django dev 80 - , screen. screen , , . , .

+1

virtualenv, sudo manage.py runserver , .

, :

env-:

which python

: /home/oleg/.virtualenvs/openmuni/bin/python

:

sudo !!

: /usr/bin/python

, , , , 0.0.0.0:80

python :

mv /usr/bin/python /usr/bin/python.old

/USR//

:

ln -s /usr/bin/python /home/oleg/.virtualenvs/openmuni/bin/python

! sudo python manage.py runserver 0.0.0.0:80 virtaulenv!

, postgres DB , , , .

@ydaniv

0
source

All Articles