TL;DR Edit: I didn't have the correct folder permissions set up.
Everything works fine when I run flask via source venv/bin/activate && python run.py
.
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello, world!"
if __name__ == "__main__":
app.debug = True
app.run(host='0.0.0.0', port=8080)
But when I run the same app with nginx/emperor.uwsgi then every hit to the server returns 500. If I comment out the SQLAlchemy import then the page loads, as expected.
Per this thread I've tried enabling lazy/lazy-app, but it has no effect. Flask is raising the exception, so nginx/uwsgi is not logging anything.
I've tried utilizing from werkzeug.debug import DebuggedApplication
but still just getting absolute bare-bones "Internal Server Error" in my browser.
Config:
[uwsgi]
uid = http
gid = http
socket = /var/run/project.uwsgi.sock
chown-socket = http
chmod-socket = 664
pidfile = /var/run/project.master.pid
master = true
lazy = true
lazy-apps = true
chdir = /srv/http/project
python-path = /srv/http/project
virtualenv = /srv/http/project/venv
module = run
callable = app
plugin = python
home = venv
Nothing unusual.
source venv/bin/activate && pip list && deactivate
output:
Flask (0.10.1)
Flask-SQLAlchemy (2.0)
itsdangerous (0.24)
Jinja2 (2.7.3)
MarkupSafe (0.23)
pip (6.0.8)
setuptools (12.0.5)
SQLAlchemy (0.9.9)
uWSGI (2.0.9)
Werkzeug (0.10.1)
All the usual suspects are present.
Completely in the dark on this one, anybody know how to debug/handle this?
Either the server is overloaded or there is an error in the application. This is the 500 Internal Server Error, which is a server error response that indicates that the server encountered an internal error in the application code.
Do you install uwsgi-emperor through the package manger as well?
Please make sure you are tracing with correct uwsgi.
Sometimes installing uwsgi from pip and apt make this problem. I myself replace the /usr/bin/uwsgi
with /usr/local/bin/uwsgi
in /etc/init.d/uwsgi
.
Also you should check the path permissions and db access if any.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With