Get debug output from Pyramid app on FCGI “production” server

129 Views Asked by At

I have a Pyramid-based app running as FCGI script on Uberspace. The FCGI loop is run by the following python script.

#!/home/gereon/sunda/bin/python
import sys

from paste.deploy import loadapp
from flup.server.fcgi_fork import WSGIServer

app = loadapp('config:/home/gereon/sunda/git-culturebank/sqlite.ini') 

if __name__ == '__main__':
WSGIServer(app).run()

The configuration looks like this.

[app:main]
use = egg:culturebank

pyramid.reload_templates = true
pyramid.debug_authorization = false
pyramid.debug_notfound = true
pyramid.debug_routematch = false
pyramid.default_locale_name = en
pyramid.includes =
    pyramid_tm
sqlalchemy.url = sqlite:///%(here)s/culturebank.sqlite

[server:main]
use = egg:waitress#main
host = 0.0.0.0
port = 6542

[loggers]
keys = root, culturebank, sqlalchemy

[handlers]
keys = console

[formatters]
keys = generic

[logger_root]
level = INFO
handlers = console

[logger_culturebank]
level = DEBUG
handlers =
qualname = culturebank

[logger_sqlalchemy]
level = WARN
handlers =
qualname = sqlalchemy.engine

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic

[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s

I'm very inexperienced in web-based python, and for some reason my app runs locally (pserve sqlite.ini), but not on my “production” server Uberspace, throwing a 500 response. How do I get my setup to show the error traceback instead?

My error log is not very helpful in this respect, it just contains pairs of lines like

[Sun Jan 07 19:14:25 2018] [warn] [client 217.63.244.188] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Sun Jan 07 19:14:25 2018] [error] [client 217.63.244.188] Premature end of script headers: culturerumah
0

There are 0 best solutions below