Skip to content

Commit

Permalink
Version 1.3.0
Browse files Browse the repository at this point in the history
Custom base URL prefix
  • Loading branch information
filak committed Apr 30, 2019
1 parent 81871a2 commit 027db39
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
5 changes: 4 additions & 1 deletion flask-app/instance/conf/mtw.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# *** Config version 0.1.6 ***
# *** Config version 0.1.7 ***
### Important values are marked with ! ###
### ! This file MUST BE UTF-8 encoded ! ###
### ! Restart the App after modifying ! ###
Expand Down Expand Up @@ -88,6 +88,9 @@ MESH_TREE = {
### Background Worker host:port [dev: 5903 -- prod: 55933] ###
WORKER_HOST = http://localhost:5903/

### Base URL prefix - default: None ###
#APP_URL_PREFIX = /fr


[sparqlconf]

Expand Down
8 changes: 5 additions & 3 deletions flask-app/mtw/flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __call__(self, environ, start_response):

app.config.update(dict(
APP_NAME = 'MTW',
APP_VER = '1.2.9',
APP_VER = '1.3.0',
API_VER = '1.0.0',
APP_URL = '/mtw',
DEFAULT_THEME = 'slate',
Expand Down Expand Up @@ -82,8 +82,10 @@ def __call__(self, environ, start_response):


def getPath(path):
customDir = app.config['APP_URL']
return(customDir+path)
app_prefix = app.config['APP_URL_PREFIX']
app_base = app.config['APP_URL']
return(app_prefix+app_base+path)


### Add security HTTP headers
csrf = SeaSurf(app)
Expand Down
1 change: 1 addition & 0 deletions flask-app/mtw_utils/mtw_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def getAdminConfValue(conf):
def getLocalConfValue(conf):
d = {}
try:
d['APP_URL_PREFIX'] = conf.get('appconf', 'APP_URL_PREFIX', fallback='')
d['DATABASE_NAME'] = conf.get('appconf', 'DATABASE_NAME', fallback='mtw.db')
d['DATABASE'] = get_instance_dir( app, 'db/'+d['DATABASE_NAME'] )
d['DEFAULT_THEME'] = conf.get('appconf', 'DEFAULT_THEME', fallback='slate')
Expand Down

0 comments on commit 027db39

Please sign in to comment.