[Answered ]-What is the correct way to leave a Django server running on an EC2 instance?

2👍

runserver is a development server. You shouldn’t use it in production, as explained at https://docs.djangoproject.com/en/1.4/ref/django-admin/#runserver-port-or-address-port where it says:

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.)

You should use one of the methods given in https://docs.djangoproject.com/en/1.4/howto/deployment/ for deploying a Django project in production. I have used mod_wsgi with Apache, gunicorn with nginx – the precise solution is up to you and the requirements of your project, but the deployment section of the Django manual goes through various options.

0👍

This really isn’t a good idea; the built in development server shouldn’t be used outside of your local development machine. Look at the docs:

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.)

Instead you should set up nginx+gunicorn/uwsgi or just apache+mod_wsgi.

If you ec2 instance is totally blocked from all possible communication from the outside world (which is unlikely) you can use the screen command

Leave a comment