This is an edit of my original question, which was how to successfully deploy a Django app to a server, because this was my first time. The following links are what I tried:
- https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04
- https://simpleisbetterthancomplex.com/tutorial/2016/10/14/how-to-deploy-to-digital-ocean.html
- https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-uwsgi-and-nginx-on-ubuntu-16-04
- https://www.linode.com/docs/web-servers/nginx/deploy-django-applications-using-uwsgi-and-nginx-on-ubuntu-14-04
- http://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html
I followed these to the letter, I got upto the part with ~/myproject/manage.py runserver 0.0.0.0:8000
but then where they show that navigating to the servers ip address on port 8000 shows an 'It worked' page, I get no response. I also ran
# test.py
def application(env, start_response):
start_response('200 OK', [('Content-Type','text/html')])
return [b"Hello World"] # python3
#return ["Hello World"] # python2
with uwsgi --http :8000 --wsgi-file test.py
, and still no response.
So after a while of banging my head against a wall, I decided to give up and skip past that part, and go straight for combining NGINX, uWSGI and my Django app. I just managed to get it working, so I will post a detailed solution below of exactly how I did that, hopefully it may help somebody else, as I found most of the instructions on the internet didn't explain somethings that I felt needed explaining to fully understand what was happening. That will suffice as a question and answer,...
although on a side note, I'm still interested in as to why without the installation of a webserver, I was still not able to visit the Django app ran with the command runserver
, if you know, please comment.