我对于使用服务器相当陌生。 我试图在uwsgi&nginx的Ubuntu 12.04 AWS上运行Django。
我find了一个我正在学习的教程: http : //uwsgi.readthedocs.org/en/latest/tutorials/Django_and_nginx.html
我创build了一个虚拟evn:
virtualenv uwsgi-tutorial cd uwsgi-tutorial source bin/activate
然后我使用pip安装了Python&Django。 然后我开始了一个名为mysite的Django项目
然后我安装了uwsgi
pip install uwsgi
然后我创build了一个test.py文件:
def application(env, start_response): start_response('200 OK', [('Content-Type','text/html')]) return "Hello World"
然后我跑了uwsgi:
uwsgi --http :8000 --wsgi-file test.py
如果我的浏览器指向我的http://myip:8000我将在浏览器中看到Hello World 。 但是,我的浏览器正在等待,因为它根本不连接到服务器。
当我运行uwsgi --http :8000 --wsgi-file test.py我得到这个输出在terminal:
*** Starting uWSGI 2.0.1 (64bit) on [Tue Feb 25 15:26:43 2014] *** compiled with version: 4.6.3 on 25 February 2014 05:36:40 os: Linux-3.2.0-59-virtual #90-Ubuntu SMP Tue Jan 7 23:02:33 UTC 2014 nodename: ip-172-31-13-105 machine: x86_64 clock source: unix detected number of CPU cores: 1 current working directory: /home/spencer/uwsgi-tutorial/mysite detected binary path: /home/spencer/uwsgi-tutorial/bin/uwsgi !!! no internal routing support, rebuild with pcre support !!! *** WARNING: you are running uWSGI without its master process manager *** your processes number limit is 4592 your memory page size is 4096 bytes detected max file descriptor number: 1024 lock engine: pthread robust mutexes thunder lock: disabled (you can enable it with --thunder-lock) uWSGI http bound on :8000 fd 4 spawned uWSGI http 1 (pid: 9729) uwsgi socket 0 bound to TCP address 127.0.0.1:37347 (port auto-assigned) fd 3 Python version: 2.7.3 (default, Sep 26 2013, 20:13:52) [GCC 4.6.3] *** Python threads support is disabled. You can enable it with --enable-threads *** Python main interpreter initialized at 0x1bbc670 your server socket listen backlog is limited to 100 connections your mercy for graceful operations on workers is 60 seconds mapped 72760 bytes (71 KB) for 1 cores *** Operational MODE: single process *** WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x1bbc670 pid: 9728 (default app) *** uWSGI is running in multiple interpreter mode *** spawned uWSGI worker 1 (and the only) (pid: 9728, cores: 1)
我可能会失去一些明显或不完全明白的东西,但任何帮助,非常感谢!
我从来没有打开港口80 …菜鸟的错误。 我希望有同样的问题的人会偶然发现,他们需要打开端口80