Hello
I have a question. What is the best way to run a django application on a server?
Using nohup python3 manage.py runserver ?
Because what I want is for the application to keep running when I close the console
Hello
I have a question. What is the best way to run a django application on a server?
Using nohup python3 manage.py runserver ?
Because what I want is for the application to keep running when I close the console
Absolutely not. From the docs on runserver.
DO NOT USE THIS SERVER IN A PRODUCTION SETTING. It has not gone through security audits or performance tests. (And that’s how it’s gonna stay. We’re in the business of making Web frameworks, not Web servers, so improving this server to be able to handle a production environment is outside the scope of Django.)
See the docs on Deploying Django and the Deployment Checklist. There are multiple ways of running Django in a server environment, picking one is as much a matter of what the rest of your environment looks like and what experience you may have with such things.
(We deploy Django projects using nginx & uwsgi for a couple of different reasons, none of which are particularly relevant here - they have nothing to do with any technical reasons regarding Django.)
I’ll toss in my two cents. Use gunicorn.
The Django deploy docs mention a bunch of options, but my belief is that gunicorn is the simplest to get started by far (and I’ve done of bunch of the options for different projects). If you’re new to all of this, I think it’s best to minimize the amount of configuration options you have to learn.