Django CMS + uWSGI + virtualenv + socket 在 uWSGI 日志中导致 PendingDeprecationWarning 错误
Django CMS + uWSGI + virtualenv + socket causing PendingDeprecationWarning error in uWSGI logs
这是错误:
Traceback (most recent call last):
File "/var/apps/tango/envs/tango-env/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 187, in __call__
self.load_middleware()
File "/var/apps/tango/envs/tango-env/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 45, in load_middleware
mw_class = import_by_path(middleware_path)
File "/var/apps/tango/envs/tango-env/local/lib/python2.7/site-packages/django/utils/module_loading.py", line 21, in import_by_path
module = import_module(module_path)
File "/var/apps/tango/envs/tango-env/local/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
File "/var/apps/tango/envs/tango-env/local/lib/python2.7/site-packages/django/middleware/doc.py", line 4, in <module>
warnings.warn(__doc__, PendingDeprecationWarning, stacklevel=2)
TypeError: expected string or buffer
类型错误:预期的字符串或缓冲区
Tango 是我专门为这个项目创建的用户。
我正在使用 upstart,所以在 /etc/init/tango-wsgi.conf 中看起来像:
exec /var/apps/tango/envs/tango-env/bin/uwsgi \
--uid tango \
--home /var/apps/tango/envs/tango-env \
--pythonpath /var/apps/tango/tango/src \
--wsgi-file /var/apps/tango/tango/src/tango_cms/wsgi.py \
--socket /tmp/tango-uwsgi.sock \
--chmod-socket \
--logdate \
--optimize 2 \
--processes 2 \
--master \
--logto /var/apps/tango/logs/uwsgi.log
更新:
我的 nginx.conf 有以下条目:
location / {
uwsgi_pass unix:/tmp/tango-uwsgi.sock;
include /etc/nginx/uwsgi_params;
}
请帮忙。
不确定为什么会出错,您可以尝试删除 "XViewMiddleware"(如果已安装)。
同样的问题。我修复了删除 tango-wsgi.conf
文件中的以下行:
--optimize 2 \
Optimize 允许某种 python 优化:More info
这是错误:
Traceback (most recent call last):
File "/var/apps/tango/envs/tango-env/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 187, in __call__
self.load_middleware()
File "/var/apps/tango/envs/tango-env/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 45, in load_middleware
mw_class = import_by_path(middleware_path)
File "/var/apps/tango/envs/tango-env/local/lib/python2.7/site-packages/django/utils/module_loading.py", line 21, in import_by_path
module = import_module(module_path)
File "/var/apps/tango/envs/tango-env/local/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
File "/var/apps/tango/envs/tango-env/local/lib/python2.7/site-packages/django/middleware/doc.py", line 4, in <module>
warnings.warn(__doc__, PendingDeprecationWarning, stacklevel=2)
TypeError: expected string or buffer
类型错误:预期的字符串或缓冲区
Tango 是我专门为这个项目创建的用户。
我正在使用 upstart,所以在 /etc/init/tango-wsgi.conf 中看起来像:
exec /var/apps/tango/envs/tango-env/bin/uwsgi \
--uid tango \
--home /var/apps/tango/envs/tango-env \
--pythonpath /var/apps/tango/tango/src \
--wsgi-file /var/apps/tango/tango/src/tango_cms/wsgi.py \
--socket /tmp/tango-uwsgi.sock \
--chmod-socket \
--logdate \
--optimize 2 \
--processes 2 \
--master \
--logto /var/apps/tango/logs/uwsgi.log
更新:
我的 nginx.conf 有以下条目:
location / {
uwsgi_pass unix:/tmp/tango-uwsgi.sock;
include /etc/nginx/uwsgi_params;
}
请帮忙。
不确定为什么会出错,您可以尝试删除 "XViewMiddleware"(如果已安装)。
同样的问题。我修复了删除 tango-wsgi.conf
文件中的以下行:
--optimize 2 \
Optimize 允许某种 python 优化:More info