Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enabling internal routing in 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

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

like image 865
Andrey Rusanov Avatar asked Dec 23 '14 16:12

Andrey Rusanov


1 Answers

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 !!!
like image 109
Andrey Rusanov Avatar answered Oct 01 '22 21:10

Andrey Rusanov