尝试使用uWSGI部署python金字塔应用程序

时间:2016-01-15 21:46:26

标签: python pyramid uwsgi

我尝试使用uWSGI部署金字塔应用程序。

当使用随附的金字塔开发服务器时,该应用程序可以正常工作。

另外,我之前已经设置了这个,我发誓它曾经工作过。

然而,现在加入魔术短语导致"此网页不可用"

我试图让所有配置参数尽可能与我目前的相似,所以我不必担心防火墙问题。

developer.ini中的uWSGI部分如下所示(来自:Setup uWSGI as webserver with pyramid (no NGINX)):

[uwsgi]
socket = localhost:8080
virtualenv = /var/www/finance/finance-env
die-on-term = 1
master = 1
#logto = /var/log/wsgi/uwsgi.log


enable-threads = true
offload-threads = N
py-autoreload = 1
wsgi-file = /var/www/finance/wsgi.py

wsgy.py看起来像这样:

from pyramid.paster import get_app, setup_logging
ini_path = '/var/www/finance/corefinance/development.ini'
setup_logging(ini_path)
application = get_app(ini_path, 'main')

现在是输出。 8080端口的所有东西似乎都听得很好。

user1@finance1:~$ sudo /var/www/finance/finance-env/bin/uwsgi --ini-paste-logg /var/www/finance/corefinance/development.ini
[uWSGI] getting INI configuration from /var/www/finance/corefinance/development.ini
*** Starting uWSGI 2.0.11.2 (64bit) on [Fri Jan 15 21:13:31 2016] ***
compiled with version: 4.7.2 on 16 November 2015 20:13:35
os: Linux-4.1.5-x86_64-linode61 #7 SMP Mon Aug 24 13:46:31 EDT 2015
nodename: finance1
machine: x86_64
clock source: unix
detected number of CPU cores: 1
current working directory: /home/user1
detected binary path: /var/www/finance/finance-env/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
your processes number limit is 3934
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 socket 0 bound to TCP address localhost:8080 fd 3
Python version: 3.2.3 (default, Feb 20 2013, 14:49:46)  [GCC 4.7.2]
Set PythonHome to /var/www/finance/finance-env
Python main interpreter initialized at 0xfd0a10
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 145536 bytes (142 KB) for 1 cores
*** Operational MODE: single process ***
WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0xfd0a10 pid: 6275 (default app)
mountpoint  already configured. skip.
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 6275)
spawned uWSGI worker 1 (pid: 6282, cores: 1)
Python auto-reloader enabled

1 个答案:

答案 0 :(得分:2)

除非您支持nginx之类的代理,否则您需要在uwsgi中使用内部http路由支持,更改

main()
{
    ArrayList<Integer> allowedValues = new ArrayList<>();
    allowedValues.add(0);
    allowedValues.add(1);
    allowedValues.add(2);
    allowedValues.add(3);
    int length = 2;

    ArrayList<ArrayList<Integer>> billionsAndBillions = new ArrayList<>();

    appendPermutations (allowedValues, billionsAndBillions, 2);
}

private List appendPermutation(List<Integer> values, List<List<Integer>> pile, int depth)
{
    depth --;
    if (pile.isEmpty())
    {       
        for (Integer value: values)
        {
            ArrayList<Integer> tmp = new ArrayList<>();
            tmp.add(value);
            pile.add(tmp);
        }
    }
    ArrayList<ArrayList<Integer>> newList = new ArrayList<>(); 
    for (List<Integer> list: pile)
    {       
        ArrayList<Integer> permutation = list.copy();
        for (Integer value: values)
        {
            permutation.add(value);
            newList.add(permutation);
        }
    }
    if (depth > 0)
    {
        newList = appendPermutation(values, newList, depth);
    }
    return newList;
}

socket = localhost:8080

以下是uwsgi http support docs