Python 3.6.8来创建venv uwsgi,安装在venv中,经过正确的符号链接,并使用正确的python版本nginx在系统范围内安装
我只是想让最基本的uwsgi --ini myinifile.ini正常工作。
尽管我花了几天的时间试图解决这个问题,但我总是回到这里,当我启动我的django应用程序时,uwsgi无法识别它。
当使用uwsgi --uwsgi-file test.py --http-socket :8001时,uwsgi工作正常
我可以很好地使用python manage.py runserver 0.0.0.0:8001,而django在启动应用程序时,在浏览应用程序网站时有0权限问题。
我已经看到这个错误很多次了,我想我是在服用疯狂的药片,错过了一些愚蠢而明显的东西。
[uWSGI] getting INI configuration from /home/saleor/saleor/saleor/wsgi/uwsgi.ini
[uwsgi-static] added mapping for /static => /app/static
*** Starting uWSGI 2.0.18 (64bit) on [Mon Nov 18 07:36:36 2019] ***
compiled with version: 7.4.0 on 18 November 2019 04:47:07
os: Linux-4.15.0 #1 SMP Thu Aug 23 19:33:51 MSK 2018
nodename: myurl.com
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 2
current working directory: /home/saleor/saleor/venv/bin
detected binary path: /home/saleor/saleor/venv/bin/uwsgi
chdir() to /home/saleor/saleor/saleor
your processes number limit is 62987
your memory page size is 4096 bytes
detected max file descriptor number: 1024
building mime-types dictionary from file /etc/mime.types...554 entry found
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address :8001 fd 3
Python version: 3.6.8 (default, Oct 7 2019, 12:59:55) [GCC 8.3.0]
PEP 405 virtualenv detected: /home/saleor/saleor/venv
Set PythonHome to /home/saleor/saleor/venv
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x558314cc3dd0
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 145808 bytes (142 KB) for 1 cores
*** Operational MODE: single process ***
ModuleNotFoundError: No module named 'saleor'
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: 7969)
spawned uWSGI worker 1 (pid: 7970, cores: 1)
^CSIGINT/SIGQUIT received...killing workers...
worker 1 buried after 1 seconds
goodbye to uWSGI. 这是我的名为:__init__.py的uwsgi.py文件
"""WSGI config for saleor project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` setting.
Usually you will have the standard Django WSGI application here, but it also
might make sense to replace the whole Django WSGI application with a custom one
that later delegates to the Django one. For example, you could introduce WSGI
middleware here, or combine a Django application with an application of another
framework.
"""
from django.core.wsgi import get_wsgi_application
from saleor.wsgi.health_check import health_check
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "saleor.settings")
# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
application = get_wsgi_application()
# Apply WSGI middleware here.
# from helloworld.wsgi import HelloWorldApplication
# application = HelloWorldApplication(application)
application = health_check(application, "/health/")这是我的uwsgi.ini
[uwsgi]
die-on-term = true
http-socket = :$(PORT)
log-format = UWSGI uwsgi "%(method) %(uri) %(proto)" %(status) %(size) %(msecs)ms [PID:%(pid):Worker-%(wid)] [RSS:%(rssM)MB]
master = true
max-requests = 100
memory-report = true
module = saleor.wsgi:application
processes = 1
static-map = /static=/app/static
mimefile = /etc/mime.types
env = /home/saelor/saleor/venv
virtualenv = /home/saleor/saleor/venv
chdir = /home/saleor/saleor/saleor
master = true
vacuum = true
chmod-socket = 666
uid = saleor
gid = saleor我只是想让uwsgi运行我的saleor应用程序,这样我就可以开始着手让它和nginx进行正确的沟通:(我迷路了,我的大脑严重受伤。
发布于 2019-12-30 20:06:47
请勿触摸任何其他设置
发布于 2021-09-10 13:38:00
我得到了这个错误,我用这种方法解决了它
3.uwsgi --http :8000 --模块saleor.wsgi
https://stackoverflow.com/questions/58910309
复制相似问题