Commit 04dbba2c authored by Jonathan Schaeffer's avatar Jonathan Schaeffer Committed by Jerome Touvier
Browse files

README

parent f08ae485
......@@ -24,10 +24,10 @@ wget -O - http://localhost:8000/1/application.wadl
Run it in debug mode with flask :
```
# WS-SACPZ
docker run --rm --name ws-sacpz -e RUNMODE=production -e FLASK_APP=start_sacpz.py ws-sacpz-resp flask run
docker build -t ws-sacpz-resp .
docker run --rm --name ws-sacpz -e RUNMODE=production ws-sacpz-resp
# WS-RESP
docker run --rm --name ws-resp -e RUNMODE=production -e FLASK_APP=start_resp.py ws-sacpz-resp flask run
docker run --rm --name ws-resp -e RUNMODE=production ws-sacpz-resp start_resp:app
```
## RUNMODE builtin values
......
VERSION = "1.0.0"
VERSION = "1.0.1"
parameters = {
......
......@@ -6,18 +6,20 @@ from flask import Flask, make_response, render_template, redirect, request
from apps.constants import VERSION
from apps.root import output
app = Flask(__name__)
app = Flask(__name__, APPLICATION_ROOT="/resifws/resp")
app.config["APPLICATION_ROOT"] = "/resifws/resp"
fmt = "[%(asctime)s] %(levelname)s [%(filename)s:%(lineno)d] [%(funcName)s] %(message)s"
loglevel = logging.INFO if os.environ.get("RUNMODE") == "prodution" else logging.DEBUG
logging.basicConfig(format=fmt, level=loglevel)
BASE_URL = "/" + VERSION.split(".")[0]
@app.route("/")
def root():
return redirect(BASE_URL)
#@app.route("/", strict_slashes=False)
#def root():
# return redirect(BASE_URL, code=301)
@app.route(BASE_URL + "/query", methods=["GET"])
......@@ -33,15 +35,16 @@ def resp_wadl():
return response
@app.route(BASE_URL + "/version", strict_slashes=False)
@app.route(BASE_URL + "/version")
def version():
response = make_response(VERSION)
response.headers["Content-Type"] = "text/plain"
return response
@app.route("/", strict_slashes=False)
@app.route(BASE_URL, strict_slashes=False)
@app.route("/")
@app.route(BASE_URL)
@app.route(BASE_URL + "/")
@app.route(BASE_URL + "/local=fr")
def resp_doc():
return render_template("resp_doc.html")
......@@ -54,4 +57,4 @@ def resp_doc_en():
# **** MAIN ****
if __name__ == "__main__":
app.run(host="0.0.0.0")
app.run()
......@@ -17,7 +17,7 @@ BASE_URL = "/" + VERSION.split(".")[0]
@app.route("/")
def root():
return redirect(BASE_URL)
return redirect(BASE_URL, code=302)
@app.route(BASE_URL + "/query", methods=["GET"])
......
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