在uWSGI中启用内部路由 [英] Enabling internal routing in uWSGI
问题描述
我有一个使用uWSGI的Django应用程序。我的uWSGI配置为:
I have a Django app working with uWSGI. My uWSGI config is:
[uwsgi]
http = 127.0.0.1:8000
env = DJANGO_SETTINGS_MODULE=my_django_app.settings
module = my_django_app.wsgi:application
home = /var/www/myapp/venv
chdir = /var/www/myapp/app
pidfile = /tmp/myapp.pid
logger = syslog
logfile-chown = True
logfile-chmod = 644
touch-logreopen = /var/www/uwsgi/log/rotate_monitor
uid = myapp
gid = myapp
master = True
vacuum = True
harakiri = 20
max-requests = 5000
processes = 4
threads = 1
post-buffering=4096
touch-reload = /var/www/myapp/conf/uwsgi.ini
route = ^/test log:someone called /test
但是route指令不起作用,我会得到常规的uwsgi日志条目。我玩过很多次,但是找不到使它起作用的方法。有任何想法吗?我的uWSGI版本是2.0.5.1
But route directive doesn't work, I get regular uwsgi log entry. I played around it a lot, but can't find a way to make it work. Any ideas? My uWSGI version is 2.0.5.1
推荐答案
我必须安装具有pcre支持的uWSGI。它解决了路由问题。
I had to install uWSGI with pcre support. It solved problem with routing.
要做到这一点,我必须安装pcre lib(对于Ubuntu,该软件包名为libpcre3),然后重新安装uWSGI。由于PCRE已经存在于您的系统中,因此将在pcre支持下自动编译uWSGI。
To do it I had to install pcre lib(for Ubuntu the package called libpcre3) and reinstall uWSGI then. Since PCRE is already in your system uWSGI will be automatically compiled with pcre support.
@ tobias.mcnulty注释中也有一些有用之处:
There are also points from @tobias.mcnulty comment that also might be useful:
- libpcre3-dev软件包
- 之后,您可能需要运行
pip install -I --no-cache-dir uwsgi
重新安装它,否则您可能只会得到相同的缓存轮。 - 日志中的错误是
!!!没有内部路由支持,使用pcre支持进行重建!!!
- libpcre3-dev package on Ubuntu also needs to be installed
- afterwards you may want to run
pip install -I --no-cache-dir uwsgi
to reinstall it, otherwise you might just get the same cached wheel. - the error in the logs is
!!! no internal routing support, rebuild with pcre support !!!
这篇关于在uWSGI中启用内部路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!