Re: WSGI troubles
Thomas Arendsen Hein <[email protected]>
| Newsgroups | gmane.comp.bug-tracking.roundup.user |
|---|---|
| Message-ID | <[email protected]> |
* Tom Ekberg <[email protected]> [20181023 17:38]: > WSGIDaemonProcess tracker_demo_pg user=www-data \ > maximum-requests=10000 processes=5 threads=1 \ > home=/opt/roundup/trackers/demo python-home=/usr/local/share/virtualenvs/tracker-env I'd recommend not using user www-data for wsgi processes for various reasons. I have a separate user for each roundup instance, but even if you only have one, better use a different user than www-data. This is how one of my entries looks in VirtualHost: Alias /test/@@file/ /srv/roundup/test/html/ RedirectMatch permanent ^/(test)$ /$1/ WSGIDaemonProcess roundup-test display-name=roundup-test user=roundup-test group=roundup-test threads=25 WSGIScriptAlias /test /srv/roundup/test/roundup.wsgi <Location /test> WSGIProcessGroup roundup-test </Location> > The demo.conf file was copied to apache's site directory and enabled. The permissions for demo_wsgi.py and demo.conf are 755 and 744, respectively, with owner/group www-data. The conf file only needs 644, i.e. not executable. But that won't cause this error. The db directory needs to be writable by the user specified in the wsgi config, everything else only needs to be readable (and executable for the wsgi script) by that user. > The apache logs weren't very illuminating saying only that there was a 'RuntimeError: response has not been started'. Is there a way to capture more data? Does anyone have a working WSGI setup? My wsgi basically looks like yours, but I have added a simple flag to enable/disable the tracker. Maybe you can verify this way that basic wsgi already works by keeping it disabled (as shown below) and checking if the "service is down for maintenance" is shown? import sys, os sys.stdout = sys.stderr enabled = False if enabled: sys.path.insert(0, '/home/intevation/roundup/current/lib/python') # obtain the WSGI request dispatcher from roundup.cgi.wsgi_handler import RequestDispatcher tracker_home = os.path.join(os.getcwd(), 'instance') application = RequestDispatcher(tracker_home) else: def application(environ, start_response): status = '503 Service Unavailable' output = 'service is down for maintenance' response_headers = [('Content-type', 'text/plain'), ('Content-Length', str(len(output)))] start_response(status, response_headers) return [output] Regards, Thomas -- Thomas Arendsen Hein <[email protected]> - OpenPGP key: 0x5BB3F5195816791A https://blogs.intevation.de/thomas/ - https://intevation.de/~thomas/ Intevation GmbH, Neuer Graben 17, 49074 Osnabrueck - AG Osnabrueck, HR B 18998 Geschaeftsfuehrer: Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner