In my droplet is running several PHP websites, recently I tried to deploy a Django website that I build. But it’s doesn’t work properly.
I will explain the step that I did.
1, Pointed a Domain name to my droplet.
2, Added Domain name using Plesk Add Domain Option.
3, Uploaded the Django files to httpdocs by Plesk file manager.
4, Connected the server through ssh and type python manage.py runserver
0:8000
5, My Django Website is successfully running.
Here are the real issues occurs, We need to type exact port number to view the website every time. Eg:- **xyz.com:8000 **
As well as the Django webserver is down after sometimes.
I am newbie to Django all I have experience in deploying a PHP website. If my procedure is wrong please guide me to correct procedure.
Thanks in Advance.
2
Answers
Django Runserver is not a production one, it should be used only for development. That’s why you need to explicitly type in the port and it sometimes go down because of code reload or other triggers.
Check Gunicorn for example, as a production server for Django applications. (there are other options also)
I suggest following this guide. Covers initial setup of django with gunicorn and nginx which is essential for deployment, you don’t have to add the port to access the site. It doesn’t cover how to add the domain but it seems you already know how to add the domain though.