Commit 1f362c58 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Moved wsgi config to app.

parent aea340bf
Pipeline #41244 passed with stages
in 15 minutes and 22 seconds
......@@ -12,20 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from werkzeug.wsgi import DispatcherMiddleware
from nomad.api import app
from nomad import config
def run_dev_server(*args, **kwargs):
def simple(env, resp):
resp(b'200 OK', [(b'Content-Type', b'text/plain')])
return [
('Development nomad api server. Api is served under %s/.' %
config.services.api_base_path).encode('utf-8')]
app.wsgi_app = DispatcherMiddleware(simple, {config.services.api_base_path: app.wsgi_app})
app.run(*args, **kwargs)
......
......@@ -20,6 +20,7 @@ from flask import Flask, jsonify
from flask_restplus import Api
from flask_cors import CORS
from werkzeug.exceptions import HTTPException
from werkzeug.wsgi import DispatcherMiddleware
import os.path
from nomad import config
......@@ -38,6 +39,17 @@ app.config.setdefault('RESTPLUS_MASK_HEADER', False)
app.config.setdefault('RESTPLUS_MASK_SWAGGER', False)
def api_base_path_response(env, resp):
resp(b'200 OK', [(b'Content-Type', b'text/plain')])
return [
('Development nomad api server. Api is served under %s/.' %
config.services.api_base_path).encode('utf-8')]
app.wsgi_app = DispatcherMiddleware(
api_base_path_response, {config.services.api_base_path: app.wsgi_app})
CORS(app)
api = Api(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment