简体   繁体   English

为什么我的Django / uWSGI vassal日志为空?

[英]Why are my Django / uWSGI vassal logs empty?

I am running my Django site as a vassal of UWSGI emperor. 我正在将我的Django网站作为UWSGI皇帝的附庸。 I have created /etc/uwsgi-emperor/vassals/mysite.ini as follows: 我创建了/etc/uwsgi-emperor/vassals/mysite.ini ,如下所示:

[uwsgi]
socket = /var/opt/mysite/uwsgi.sock
chmod-socket = 775
chdir = /opt/mysite
master = true
virtualenv = /opt/mysite_virtualenv
env = DJANGO_SETTINGS_MODULE=mysite.settings
module = mysite.wsgi:application
uid = www-data
gid = www-data
processes = 1
threads = 1
plugins = python3,logfile
logger = file:/var/log/uwsgi/app/mysite.log
vacuum = true

But /var/log/uwsgi/app/mysite.log does not get created. 但是/var/log/uwsgi/app/mysite.log未创建。 If I touch it, it remains empty. 如果我touch它,它仍然是空的。 This occurs even after I trigger 500-style errors in the application. 即使我在应用程序中触发了500个样式的错误,也会发生这种情况。

Why aren't my logs being written? 为什么不写我的日志?

The vassal does not have permission to write to the file (or create the file in the first place). 附庸无权写入文件(或首先创建文件)。 You should 你应该

cd /var/log/uwsgi/app
touch mysite.log # create the file
chown www-data:www-data mysite.log # give the vassal permission

(where www-data:www-data matches the uid and gid values in your ini file). (其中www-data:www-data与ini文件中的uid和gid值匹配)。

Logs will start appearing shortly. 日志将很快出现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM