How to start uwsgi with flask and nginx
This is probably related to how you installed uwsgi. This warning:
!!! no internal routing support, rebuild with pcre support !!!
has nothing to do with your application, it is about your uwsgi binary.
Basically it says that one part of uwsgi has not been enabled in the binary that you are using. That specific functionality is not needed to run your Flask application, so you can ignore the warning. But if you want to learn more, see this question for some information about this problem and how to solve it.
Now, regarding this other warning:
*** WARNING: you are running uWSGI without its master process manager ***
I think you are missing the --master
option, to enable the prefork server.
waTEXmelon
Updated on July 09, 2022Comments
-
waTEXmelon over 1 year
I guess my main problem is that i don't know, how file hierarchy should look like ? So far i was following Grinberg's tutorial in his "Flask development" book. So i have like:
--manage.py ( Flask's Script extension script) --app/ ( application folder as a package) --virtual_env
and not sure what all i messed up, but now when i try whatever with uwsgi command , it says following error :
current working directory: /home/gaucan/temp/my_app detected binary path: /usr/bin/uwsgi !!! no internal routing support, rebuild with pcre support !!! *** WARNING: you are running uWSGI without its master process manager ***
EDIT: starting it like this worked:
uwsgi --http :9090 -w manage:app --enable-threads
this worked ... in manage.py i had line:
app=create_app('default')
so that was pretty much all i guess i needed to do...but i still cant get anyhow get rid of warning above... that i am running uwsgi without its master process manager... is it OK ? or have i done wrong something?
this is just created /etc/nginx/nginx.conf file
worker_processes 1; events { worker_connections 1024; } http { sendfile on; gzip on; gzip_http_version 1.0; gzip_proxied any; gzip_min_length 500; gzip_disable "MSIE [1-6]\."; gzip_types text/plain text/xml text/css text/comma-separated-values text/javascript application/x-javascript application/atom+xml; # Configuration containing list of application servers upstream uwsgicluster { server 127.0.0.1:8080; # server 127.0.0.1:8081; # .. # . } # Configuration for Nginx server { # Running port listen 80; # Settings to by-pass for static files location ^~ /static/ { # Example: # root /full/path/to/application/static/file/dir; root /app/static/; } # Serve a static file (ex. favico) outside static dir. location = /favico.ico { root /app/favico.ico; } # Proxying connections to application servers location / { include uwsgi_params; uwsgi_pass uwsgicluster; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Host $server_name; } }
}
-
waTEXmelon over 8 yearsbtw is my nginx and uwsgi connected together? i mean i start uwsgi with uwsgi --http :8080 -w manage:app --enable-threads --master but what should i do with nginx then? like i start it with
nginx
and then i trynginx -s reload
, but nothing seems to be happening, and in documentation they write ", the master process starts new worker processes and sends messages to old worker processes, requesting them to shut down" So i guess i should see some messages by uwsgi, which i dont see... right? -
waTEXmelon over 8 yearssimply what i am asking how should nginx.conf look like and with which arguments i should uwsgi start, so that they work together? i cant get it done right... u can see my .conf at the original post
-
H S Rathore over 5 years--master did the work for me now I don't see the warning any more.