Skip to content
Snippets Groups Projects
Commit 1f362c58 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Moved wsgi config to app.

parent aea340bf
No related branches found
No related tags found
No related merge requests found
Pipeline #41244 passed
...@@ -12,20 +12,10 @@ ...@@ -12,20 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from werkzeug.wsgi import DispatcherMiddleware
from nomad.api import app from nomad.api import app
from nomad import config
def run_dev_server(*args, **kwargs): 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) app.run(*args, **kwargs)
......
...@@ -20,6 +20,7 @@ from flask import Flask, jsonify ...@@ -20,6 +20,7 @@ from flask import Flask, jsonify
from flask_restplus import Api from flask_restplus import Api
from flask_cors import CORS from flask_cors import CORS
from werkzeug.exceptions import HTTPException from werkzeug.exceptions import HTTPException
from werkzeug.wsgi import DispatcherMiddleware
import os.path import os.path
from nomad import config from nomad import config
...@@ -38,6 +39,17 @@ app.config.setdefault('RESTPLUS_MASK_HEADER', False) ...@@ -38,6 +39,17 @@ app.config.setdefault('RESTPLUS_MASK_HEADER', False)
app.config.setdefault('RESTPLUS_MASK_SWAGGER', 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) CORS(app)
api = Api( api = Api(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment