Enabling internal routing in uWSGI

安稳与你 提交于 2019-12-01 16:41:42

问题


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

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


回答1:


I had to install uWSGI with pcre support. It solved problem with routing.

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.

There are also points from @tobias.mcnulty comment that also might be useful:

  • 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 !!!


来源:https://stackoverflow.com/questions/27624414/enabling-internal-routing-in-uwsgi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!