Question

Flask-Rest unable to load configuration from uwsgi...postman 404 Not Found

Im trying to deploy Flask-restfull Api in Digitalocean platform i installed phpmyadmin,nginx,mysqlserver and php in ubuntu 16.04.3 x64 based on this tutorial here after that i can access my db from browser and login to it successfully …The Problems Appeard after i run the uwsgi.service…the postman display this error 404 Not Found nginx/1.10.3 (Ubuntu) also i cant access phpmyadmin from browser.

what i did: from logs WARNING i knew that uwsgi should run as root i searched but nothing usefull…any help?? thanks in advance…the Errors and WARNING log file:-

Starting uWSGI 2.0.16 (64bit) on [Thu Feb 22 19:36:50 2018] 
compiled with version: 5.4.0 20160609 on 22 February 2018 16:38:36
os: Linux-4.4.0-112-generic #135-Ubuntu SMP Fri Jan 19 11:48:36 UTC 2018
nodename: Flask-Api-Test
machine: x86_64
clock source: unix
detected number of CPU cores: 1
current working directory: /
detected binary path: /var/www/html/items-rest/venv/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
dropping root privileges as early as possible
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
your processes number limit is 3913
your memory page size is 4096 bytes
 *** WARNING: you have enabled harakiri without post buffering. Slow upload could be rejected on post-unbuffered webservers *** 
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to UNIX address /var/www/html/items-rest/socket.sock fd 3
dropping root privileges after socket binding
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
Python version: 3.5.2 (default, Nov 23 2017, 16:37:01)  [GCC 5.4.0 20160609]
Set PythonHome to /var/www/html/items-rest/venv
Python main interpreter initialized at 0xda8f80
dropping root privileges after plugin initialization
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 1315008 bytes (1284 KB) for 64 cores
*** Operational MODE: preforking+threaded ***
added /var/www/html/items-rest/ to pythonpath.
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with stat
*** has_emperor mode detected (fd: 6) ***
unable to load configuration from uwsgi
Show comments

Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

KFSys
Site Moderator
Site Moderator badge
May 5, 2023

Heya all,

For anyone stumbuling upon this:

Based on the provided logs, it appears that there are two main issues: running uWSGI as root and issues with the uWSGI configuration file.

Running uWSGI as root: It is not recommended to run uWSGI as root due to security reasons. You can add the --uid and --gid options to the uWSGI command to run it as a non-root user. You can create a new user, or use an existing user like www-data.

  1. uwsgi --uid www-data --gid www-data ...

Make sure the www-data user has the necessary permissions to access the required files and directories.

uWSGI configuration issues: The log says “unable to load configuration from uwsgi”. This suggests that there might be an issue with the uWSGI configuration file. Ensure that the uWSGI configuration file is in the correct location and has the correct format.

Check the path to your uWSGI configuration file (typically named uwsgi.ini). Ensure that the file exists and that uWSGI is pointing to the correct path. Also, make sure the file is readable by the user running uWSGI.

Next, check the contents of the uwsgi.ini file to ensure it’s properly configured. Here’s a sample uWSGI configuration for a Flask application:

[uwsgi]
http-timeout = 86400
module = wsgi:app
master = true
processes = 5
socket = /var/www/html/items-rest/socket.sock
chmod-socket = 664
vacuum = true
die-on-term = true

Update the module line to point to your Flask app object. If your Flask app is defined in a file named app.py, and the Flask app object is named app, then the line should be module = app:app.

After addressing these two issues, restart your uWSGI service and check if the issues are resolved. If you still encounter issues, please provide more information about your uWSGI and Nginx configurations, as well as any relevant log messages.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel