1 # Copyright (C) 2015 by the Free Software Foundation, Inc.
3 # This file is part of GNU Mailman.
5 # GNU Mailman is free software: you can redistribute it and/or modify it under
6 # the terms of the GNU General Public License as published by the Free
7 # Software Foundation, either version 3 of the License, or (at your option)
10 # GNU Mailman is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 # You should have received a copy of the GNU General Public License along with
16 # GNU Mailman. If not, see <http://www.gnu.org/licenses/>.
18 """Experimental Gunicorn based REST server.
20 To use this do the following:
22 * Install gunicorn as a Python 3 application (in a venv if necessary).
23 * Create a mailman.cfg with at least the following it it:
28 * Start Mailman as normal: `mailman start`
29 * Set the MAILMAN_CONFIG_FILE environment variable to the location of your
30 mailman.cfg file from above.
31 * Run: gunicorn mailman.rest.gunicorn:make_application
38 # Initializing the Mailman system once.
39 from mailman
.core
.initialize
import initialize
41 from mailman
.rest
.wsgiapp
import make_application
as base_application
42 app
= base_application()
45 def make_application(environ
, start_response
):
46 """Create the WSGI application.
48 Use this if you want to integrate Mailman's REST server with an external
49 WSGI server, such as gunicorn. Be sure to set the $MAILMAN_CONFIG_FILE
52 return app(environ
, start_response
)