Skip to content

Commit 027db39

Browse files
committed
Version 1.3.0
Custom base URL prefix
1 parent 81871a2 commit 027db39

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

flask-app/instance/conf/mtw.ini

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# *** Config version 0.1.6 ***
2+
# *** Config version 0.1.7 ***
33
### Important values are marked with ! ###
44
### ! This file MUST BE UTF-8 encoded ! ###
55
### ! Restart the App after modifying ! ###
@@ -88,6 +88,9 @@ MESH_TREE = {
8888
### Background Worker host:port [dev: 5903 -- prod: 55933] ###
8989
WORKER_HOST = http://localhost:5903/
9090

91+
### Base URL prefix - default: None ###
92+
#APP_URL_PREFIX = /fr
93+
9194

9295
[sparqlconf]
9396

flask-app/mtw/flask.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def __call__(self, environ, start_response):
4646

4747
app.config.update(dict(
4848
APP_NAME = 'MTW',
49-
APP_VER = '1.2.9',
49+
APP_VER = '1.3.0',
5050
API_VER = '1.0.0',
5151
APP_URL = '/mtw',
5252
DEFAULT_THEME = 'slate',
@@ -82,8 +82,10 @@ def __call__(self, environ, start_response):
8282

8383

8484
def getPath(path):
85-
customDir = app.config['APP_URL']
86-
return(customDir+path)
85+
app_prefix = app.config['APP_URL_PREFIX']
86+
app_base = app.config['APP_URL']
87+
return(app_prefix+app_base+path)
88+
8789

8890
### Add security HTTP headers
8991
csrf = SeaSurf(app)

flask-app/mtw_utils/mtw_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ def getAdminConfValue(conf):
5858
def getLocalConfValue(conf):
5959
d = {}
6060
try:
61+
d['APP_URL_PREFIX'] = conf.get('appconf', 'APP_URL_PREFIX', fallback='')
6162
d['DATABASE_NAME'] = conf.get('appconf', 'DATABASE_NAME', fallback='mtw.db')
6263
d['DATABASE'] = get_instance_dir( app, 'db/'+d['DATABASE_NAME'] )
6364
d['DEFAULT_THEME'] = conf.get('appconf', 'DEFAULT_THEME', fallback='slate')

0 commit comments

Comments
 (0)