- 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
~/myproject/manage.py runserver 0.0.0.0:8000
这一步,但当他们展示导航到服务器IP地址和端口8000时显示一个 'It worked' 页面时,我没有得到任何响应。# test.py
def application(env, start_response):
start_response('200 OK', [('Content-Type','text/html')])
return [b"Hello World"] # python3
#return ["Hello World"] # python2
通过
uwsgi --http :8000 --wsgi-file test.py
,但仍然没有响应。在我苦思冥想了一段时间后,我决定放弃并跳过那一部分,直接将NGINX,uWSGI和我的Django应用程序结合起来。我刚刚设法让它工作,所以我会在下面发布一个详细的解决方案,说明我是如何做到这一点的,希望可以帮助其他人,因为我发现互联网上的大部分指导都没有解释一些需要解释才能充分理解正在发生的事情的内容。这将足以作为问题和答案...... 尽管附注一下,我仍然对于为什么在没有安装Web服务器的情况下我仍无法访问使用runserver
命令运行的Django应用程序感兴趣,如果您知道,请评论。