There is no "manage.py server" management command. There is only "manage.py
runserver", which you probably know already, and which is meant only for
development, not for production. For development, "manage.py runserver" works
wonders, and stopping it with Ctrl+C is all you want.

For production, you don't start Django with manage.py. Instead, you use a
specialized web server that can run Python programs by using the WSGI
specification. The three popular such servers are gunicorn, mod_wsgi, and uwsgi.
That server is going to import your mysite.wsgi.application() function and call
it as needed (as specified by the WSGI specification). So you don't need to
start "Django", you need to start gunicorn or mod_wsgi or uwsgi (which you
configure to import your Django project).

mod_wsgi is started by the Apache web server. For gunicorn and uwsgi, you need
to start them using systemd or supervisor or a similar daemon manager, which
will take care of its pids and everything else you need.

Antonis Christofides
http://djangodeployment.com


On 2016-11-26 09:06, anatoly techtonik wrote:
> Is there a plugin that allows me to start and stop django server from command
> line?
>
> Suppose I have multiple sites running at the same time, so going `ps aux` to
> manually inspect which site to kill is a time stealer. I expect that
> `manage.py server stop` stop all servers that were run for the current
> development project.
>
>     manage.py server stop    -- stop dev server(s) run for current project
>
> Also, `server start` should store pid somewhere, so that it could be checked
> and killed. What is the best place to store that?
>
>     manage.py server start    -- start django server for current project in
> foreground
>
>     options:
>       -b, --background     -- run server in background
>       --autoport              -- select port automatically
>       --dump                  -- dump server parameters (port, pid, etc) in
> JSON format (disables other stdout output)
>
>
> $ manage server start --dump
> {
>   'addr: 127.0.0.1,
>   'port': 8080,
>   'pid': 13224,
>   'pidfile': '/tmp/django-project1`
> }
>
>
> Automatic port selection is needed if you want to preview another branch with
> a temporary copy of current project. Maybe there is a plugin for branch
> testing/preview too that can help me?
>
> Thanks.
> -- 
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com
> <mailto:django-users@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0d442f3c-4b27-496b-aa6b-12acb18cad88%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/0d442f3c-4b27-496b-aa6b-12acb18cad88%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d7fc3766-5c67-6ca4-5b85-e43315dbe47d%40djangodeployment.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to