Ubuntu 12.04 Server-具有uWsgi的Django无法正常工作


1

我对使用服务器非常陌生。我正在尝试使用uwsgi和nginx在Ubuntu 12.04 AWS上运行Django。

我找到了我正在关注的教程:http : //uwsgi.readthedocs.org/en/latest/tutorials/Django_and_nginx.html

我创建了一个虚拟的evn:

virtualenv uwsgi-tutorial
cd uwsgi-tutorial
source bin/activate

然后我使用pip安装了Python和Django。然后我开始了一个名为Django的项目mysite

然后我安装了uwsgi

pip install uwsgi

然后我创建了一个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我在终端中得到以下输出:

*** 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端口...菜鸟错误。我希望有人遇到同样的问题,并
偶然

您应该将其发布为自我回答而不是评论。您应该现在就可以这样做(如果您的代表少于100名,则需要等待8个小时)。 serverfault.com/help/self-answer
Katherine Villyard 2014年

Answers:


2

我从来没有打开80端口...菜鸟错误。我希望有相同问题的人会偶然发现这一点,并意识到他们需要打开80号端口

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.