Django: не удалось запустить приложение с помощью uwsgi - PullRequest
0 голосов
/ 22 апреля 2020

Я пытаюсь запустить приложение django, используя uwsgi, но оно постоянно выдает одну ошибку: не удается импортировать модуль сайта

, проблема в том, что ранее он запускался под python2 .7 env, но затем я переключился на виртуальный env с python3 .6 и после этого я не смог запустить этот проект под python3 .6 env, он всегда работает в 2.7

Я пробовал все учебники, но я не смог получить результат

это мой файл uwsgi.ini:

[uwsgi]

# telling user to execute file


# telling group to execute file
#gid = webapps

# name of project you during "django-admin startproject <name>"
project_name = xyz_dev

# building base path to where project directory is present [In my case this dir is also where my virtual env is]
base_dir = /home/ubuntu/croydoner/%(project_name)

# set PYTHONHOME/virtualenv or setting where my virtual enviroment is
# WSGIPythonPath = /usr/local/lib/python2.7/dist-packages/
virtualenv = /home/ubuntu/croydoner/venv/
# plugins-dir = /usr/local/uwsgi-2.0.18/plugins/python
# plugins = python3.6
# unprivileged-binary-patch = /home/ubuntu/croydoner/venv/bin/uwsgi

# changig current directory to project directory where manage.py is present
chdir = %(base_dir)

# loading wsgi module
wsgi-file =  %(base_dir)/demo/wsgi.py
http = :8090

# enabling master process with n numer of child process
master = true
processes = 4

# enabling multithreading and assigning threads per process
enable-threads  = true
threads = 2

# Bind to the specified socket using default uwsgi protocol.
uwsgi-socket = %(base_dir)/run/uwsgi.sock

# set the UNIX sockets’ permissions to access
chmod-socket = 666

# Set internal sockets timeout in seconds.
socket-timeout = 300


# respawn processes after serving 5000 requests
max-requests = 5000

# clear environment on exit
vacuum = true

# path to where uwsgi logs will be saved
logto = %(base_dir)/log/uwsgi.log

Это журнал:

compiled with version: 7.5.0 on 09 April 2020 16:48:08
os: Linux-4.15.0-1065-aws #69-Ubuntu SMP Thu Mar 26 02:17:29 UTC 2020
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 2
current working directory: /home/ubuntu/sites
detected binary path: /usr/local/bin/uwsgi
chdir() to /home/ubuntu/xyz/xyz_dev
your processes number limit is 31493
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: enabled
uWSGI http bound on :8090 fd 6
uwsgi socket 0 bound to UNIX address /home/ubuntu/xyz/xyz_dev/run/uwsgi.sock fd 10
Python version: 2.7.17 (default, Apr 15 2020, 17:20:14)  [GCC 7.5.0]
Set PythonHome to /home/ubuntu/xyz/venv/
ImportError: No module named site
VACUUM: unix socket /home/ubuntu/xyz/xyz_dev/run/uwsgi.sock removed.

это файл uwsgi.service

[Unit]
Description=uWSGI Emperor service
After=network.target

[Service]
User=ubuntu

ExecStart=/usr/local/bin/uwsgi --emperor /home/ubuntu/sites/
Restart=always
KillSignal=SIGQUIT
Type=notify
NotifyAccess=all

[Install]
WantedBy=multi-user.target
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...