调试uwsgi没有问题,单独启用django也没有问题,但是使用uwsgi启动我的django的时候,会报错
Python version: 3.6.9 (default, Jan 26 2021, 15:33:00) [GCC 8.4.0]
PEP 405 virtualenv detected: /home/cute/testproj/venv
Set PythonHome to /home/cute/testproj/venv
Python main interpreter initialized at 0x564af5aff3a0
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
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 166688 bytes (162 KB) for 2 cores
*** Operational MODE: threaded ***
Traceback (most recent call last):
File "/home/cute/testproj/testproj/wsgi.py", line 16, in <module>
application = get_wsgi_application()
File "/home/cute/testproj/venv/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
django.setup(set_prefix=False)
File "/home/cute/testproj/venv/lib/python3.6/site-packages/django/__init__.py", line 19, in setup
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
File "/home/cute/testproj/venv/lib/python3.6/site-packages/django/conf/__init__.py", line 82, in __getattr__
self._setup(name)
File "/home/cute/testproj/venv/lib/python3.6/site-packages/django/conf/__init__.py", line 69, in _setup
self._wrapped = Settings(settings_module)
File "/home/cute/testproj/venv/lib/python3.6/site-packages/django/conf/__init__.py", line 170, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'testproj'
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
这是我的ini文件
[uwsgi]
socket = 127.0.0.1:8090
chdir = /home/cute/testproj/testproj
wsgi-file = /home/cute/testproj/testproj/wsgi.py
master = true
proccesses = 5
threads = 2
vacuum = true
safe-pidfile = /home/cute/testproj/testproj.pid
daemonize = /home/cute/testproj/uwsgilog.log
home = /home/cute/testproj/venv
我的虚拟环境是使用
python -m venv venv
设置的。