2016-09-30 7 views
1

Я пытаюсь запустить django, но у uwsgi возникают проблемы с загрузкой чего-либо. Скорее всего, мое невежество. Я хотел бы, чтобы некоторые помогли стрелять. Я смотрел аналогичные сообщения об обмене стеками, но ни один из них не помог, все они довольно специфичны.Arch Nginx Uwsgi приложение не загружено

В /etc/uwsgi/ У меня есть .ini файл конфигурации и .py файл, который я хочу uwsgi провести порт 2929.

В /etc/uwsgi/test.ini:

[uwsgi] 
socket=127.0.0.1:2929 
plugin=python 
wsgi-file=/etc/uwsgi/test.py 
master=True 

В /etc/uwsgi/test.py:

def application(env, start_response): 
    start_response('200 OK', [('Content-Type','text/html')]) 
    return [b"Hello World"] 

В /etc/nginx/sites/test.conf, который включен и загружен в Nginx:

upstream test_uwsgi{       
server 127.0.0.1:2929; 
} 
server{ 
listen 80; 
server_name test.example.com; 
location/{ 
    include uwsgi_params; 
    uwsgi_pass test_uwsgi; 
} 
} 

Примечание: Я использую Arch Lin УБ.

перезапустить nginx, а затем начать test.ini с помощью uwsgi:

systemctl restart nginx 
systemctl start [email protected] 

Как удается запустить/активировать без ошибок. Когда я проверяю журнал/журнал для [email protected] услуг:

Sep 30 11:29:23 Nexus systemd[1]: Starting uWSGI service unit... 
Sep 30 11:29:23 Nexus uwsgi[576]: [uWSGI] getting INI configuration from /etc/uwsgi/test.ini 
Sep 30 11:29:23 Nexus uwsgi[576]: *** Starting uWSGI 2.0.13.1 (64bit) on [Fri Sep 30 11:29:23 2016] *** 
Sep 30 11:29:23 Nexus uwsgi[576]: compiled with version: 6.1.1 20160501 on 01 June 2016 05:45:41 
Sep 30 11:29:23 Nexus uwsgi[576]: os: Linux-4.7.2-1-ARCH #1 SMP PREEMPT Sat Aug 20 23:02:56 CEST 2016 
Sep 30 11:29:23 Nexus uwsgi[576]: nodename: Nexus 
Sep 30 11:29:23 Nexus uwsgi[576]: machine: x86_64 
Sep 30 11:29:23 Nexus uwsgi[576]: clock source: unix 
Sep 30 11:29:23 Nexus uwsgi[576]: pcre jit disabled 
Sep 30 11:29:23 Nexus uwsgi[576]: detected number of CPU cores: 4 
Sep 30 11:29:23 Nexus uwsgi[576]: current working directory:/
Sep 30 11:29:23 Nexus uwsgi[576]: detected binary path: /usr/bin/uwsgi 
Sep 30 11:29:23 Nexus uwsgi[576]: uWSGI running as root, you can use --uid/--gid/--chroot options 
Sep 30 11:29:23 Nexus uwsgi[576]: *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
Sep 30 11:29:23 Nexus uwsgi[576]: your processes number limit is 28969 
Sep 30 11:29:23 Nexus uwsgi[576]: your memory page size is 4096 bytes 
Sep 30 11:29:23 Nexus uwsgi[576]: detected max file descriptor number: 1024 
Sep 30 11:29:23 Nexus uwsgi[576]: lock engine: pthread robust mutexes 
Sep 30 11:29:23 Nexus uwsgi[576]: thunder lock: disabled (you can enable it with --thunder-lock) 
Sep 30 11:29:23 Nexus uwsgi[576]: uwsgi socket 0 bound to TCP address 127.0.0.1:2929 fd 4 
Sep 30 11:29:23 Nexus uwsgi[576]: Python version: 3.5.2 (default, Jun 28 2016, 08:46:01) [GCC 6.1.1 20160602] 
Sep 30 11:29:23 Nexus uwsgi[576]: *** Python threads support is disabled. You can enable it with --enable-threads *** 
Sep 30 11:29:23 Nexus uwsgi[576]: Python main interpreter initialized at 0xcbfb40 
Sep 30 11:29:23 Nexus uwsgi[576]: your server socket listen backlog is limited to 100 connections 
Sep 30 11:29:23 Nexus uwsgi[576]: your mercy for graceful operations on workers is 60 seconds 
Sep 30 11:29:23 Nexus uwsgi[576]: mapped 145536 bytes (142 KB) for 1 cores 
Sep 30 11:29:23 Nexus uwsgi[576]: *** Operational MODE: single process *** 
Sep 30 11:29:23 Nexus uwsgi[576]: unable to find "application" callable in file /etc/uwsgi/test.py 
Sep 30 11:29:23 Nexus uwsgi[576]: unable to load app 0 (mountpoint='') (callable not found or import error) 
Sep 30 11:29:23 Nexus uwsgi[576]: *** no app loaded. going in full dynamic mode *** 
Sep 30 11:29:23 Nexus uwsgi[576]: *** uWSGI is running in multiple interpreter mode *** 
Sep 30 11:29:23 Nexus uwsgi[576]: spawned uWSGI master process (pid: 576) 
Sep 30 11:29:23 Nexus uwsgi[576]: spawned uWSGI worker 1 (pid: 590, cores: 1) 
Sep 30 11:29:23 Nexus systemd[1]: Started uWSGI service unit. 
Sep 30 11:29:26 Nexus uwsgi[576]: -- unavailable modifier requested: 14 -- 
Sep 30 11:29:26 Nexus uwsgi[576]: -- unavailable modifier requested: 14 -- 

Я думаю, что ключевая строка в целом этот журнал является:

*** no app loaded. going in full dynamic mode *** 

UWSGI не может найти файл питона?

Как это получить?

Любая помощь очень ценится!

+0

где вы указали путь к файлу project.wsgi? –

+0

Попробуйте использовать опцию 'chdir' в' test.ini', которую 'uwsgi' использует для указания рабочего каталога. Затем назначьте относительный путь к вашему файлу приложения (т. Е. 'Test.py') в опцию' wsgi-file' в ini-файле. – vrs

ответ

1

Неправильно настроена ваша среда. Используйте домашнюю переменную в файле конфигурации uwsgi.