ImportError: Никакой модуль не назвал os [Python+Flask+uwsgi+Ngnix+Ubuntu16.04]

Я пытаюсь разместить свою веб-страницу в сервере с ОС Ubuntu 16.04 и Python2/Flask/uwsgi (император).

Конфигурация emperor в /etc/uwsgi/emperor.ini следующие:

[uwsgi]

emperor = /etc/uwsgi/vassals

uid = www-data

gid = www-data

и сервис императора может запускаться обычно, начиная с результатов sudo systemctl status emperor.uwsgi показывает, что uwsgi ini файл обычно загружается:

?.emperor.uwsgi.service - uWSGI Emperor
  Loaded: loaded (/etc/systemd/system/emperor.uwsgi.service; enabled; vendor preset: enable
  Active: active (running) since Sun 2017-01-08 00:18:03 EST; 43min ago
 Main PID: 150 (uwsgi)
  Status: "The Emperor is governing 1 vassals"
  CGroup: /system.slice/emperor.uwsgi.service
          ?..150 /usr/local/bin/uwsgi --ini /etc/uwsgi/emperor.ini
          ?..160 /usr/local/bin/uwsgi --ini proxy.ini
          ?..172 /usr/local/bin/uwsgi --ini proxy.ini
Jan 08 00:18:03 localhost uwsgi[150]: *** WARNING: you are running uWSGI without its master 
Jan 08 00:18:03 localhost uwsgi[150]: your processes number limit is 579533
Jan 08 00:18:03 localhost uwsgi[150]: your memory page size is 4096 bytes
Jan 08 00:18:03 localhost uwsgi[150]: detected max file descriptor number: 1024
Jan 08 00:18:03 localhost uwsgi[150]: * ** starting uWSGI Emperor ***
Jan 08 00:18:03 localhost systemd[1]: Started uWSGI Emperor.
Jan 08 00:18:03 localhost uwsgi[150]: * ** has_emperor mode detected (fd: 7) ***
Jan 08 00:18:03 localhost uwsgi[150]: [uWSGI] getting INI configuration from proxy.ini
Jan 08 00:18:03 localhost uwsgi[150]: Sun Jan  8 00:18:03 2017 - [emperor] vassal proxy.ini 
Jan 08 00:18:03 localhost uwsgi[150]: Sun Jan  8 00:18:03 2017 - [emperor] vassal proxy.ini 

Каталог веб-страницы /var/www/proxy и uwsgi ini файл /var/www/proxy/proxy.ini следующим образом:

[uwsgi]
base = /var/www/proxy
app = index
module = %(app)
home = %(base)
pythonpath = %(base)
socket = /var/www/proxy/%n.sock
chmod-socket  = 666 
callable = app 
logto = /var/log/uwsgi/%n.log
no-site=true

nginx конфигурационный файл /etc/nginx/sites-enabled/proxy:

upstream flask {
    server unix:///var/www/proxy/proxy.sock;
}

# Default server configuration
server {
    listen 80;
    server_name proxy.foool.net;
    charset utf-8;

    location / {
        uwsgi_pass flask;
        include uwsgi_params;
    }
}

Однако это возвращает a Internal Server Error при открытии веб-страницы и файла журнала /var/log/uwsgi/proxy.log шоу ImportError: Никакой модуль под названием Ошибка OS. посмотрите больше деталей:

machine: x86_64
compiled with version: 5.4.0 20160609 on 07 January 2017 23:28:17
os: Linux-2.6.32-042stab113.21 #1 SMP Wed Mar 23 11:05:25 MSK 2016
nodename: localhost
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 1
current working directory: /etc/uwsgi/vassals
detected binary path: /usr/local/bin/uwsgi
your processes number limit is 579533
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 UNIX address /var/www/proxy/proxy.sock fd 3
Python version: 2.7.12 (default, Nov 19 2016, 06:48:10)  [GCC 5.4.0 20160609]
Set PythonHome to /var/www/proxy
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x1fb4bf0
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 145520 bytes (142 KB) for 1 cores
*** Operational MODE: single process ***
added /var/www/proxy/ to pythonpath.
Traceback (most recent call last):
  File "/var/www/proxy/index.py", line 2, in <module>
    import os
ImportError: No module named os
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 160)
spawned uWSGI worker 1 (pid: 172, cores: 1)

Так, Как я могу решить эту проблему ImportError? Мой Python по умолчанию является python2.7.12, и pip3 не установлен.

Обновление:

Обойдите systemctl и emperor, мой проект работает с командой uwsgi --socket 0.0.0.0:5000 --protocol=http -w index:application, таким образом, я думаю, что uwsgi прекрасен.

1
задан 9 January 2017 в 04:29

0 ответов

Другие вопросы по тегам:

Похожие вопросы: