Skip to content

Commit

Permalink
Version 1.3.5
Browse files Browse the repository at this point in the history
Add Flask-Session & Flask-Caching
Updates for Python 3.8 - build scripts
  • Loading branch information
filak committed Mar 22, 2020
1 parent 6fb7df6 commit f12e654
Show file tree
Hide file tree
Showing 72 changed files with 24,109 additions and 159 deletions.
51 changes: 51 additions & 0 deletions flask-app/!!build__mtw-server-win-service_Py3.7.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
@echo off
setlocal
echo.
set python=c:\Python37\Scripts\pyinstaller.exe
echo Build using pyinstaller : %python%
set targetDir=dist
set fileHandle=mtw-server-win-service
set srcFile=%fileHandle%.py
set srcDir=mtw
set logFile=!build_%fileHandle%.rep

echo. > %logFile%

echo.
echo rem call %targetDir%\%fileHandle%.exe stop

echo.
echo Building %srcFile% ...

CALL %python% --log-level ERROR --onefile ^
--hidden-import=_cffi_backend --hidden-import=pkg_resources.py2_warn ^
--add-data mtw_utils/pyuca/*.txt;pyuca ^
--distpath %targetDir% %srcFile% >> %logFile% 2>&1

echo - Done!
echo.
echo Cleaning static files %targetDir% ...

RMDIR %targetDir%\static /S /Q
RMDIR %targetDir%\templates /S /Q

echo - Done!
echo.
echo Copying files...

MKDIR %targetDir%\static
xcopy %srcDir%\static %targetDir%\static /E /Q /Y
MKDIR %targetDir%\templates
xcopy %srcDir%\templates %targetDir%\templates /E /Q /Y
echo - Done!
echo.

echo.
echo rem call %targetDir%\%fileHandle%.exe install
echo.
echo rem call %targetDir%\%fileHandle%.exe start

echo Finished
echo.

endlocal
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
@echo off
setlocal
echo.
echo Build using pyinstaller
set python=c:\Programs\Python\Python38\Scripts\pyinstaller.exe
echo Build using pyinstaller : %python%
set targetDir=dist
set fileHandle=mtw-server-win-service
set srcFile=%fileHandle%.py
Expand All @@ -16,7 +17,10 @@ echo rem call %targetDir%\%fileHandle%.exe stop
echo.
echo Building %srcFile% ...

CALL c:\Python37\Scripts\pyinstaller.exe --log-level ERROR --onefile --hidden-import=pkg_resources.py2_warn --hidden-import=_cffi_backend --add-data mtw_utils/pyuca/*.txt;pyuca --distpath %targetDir% %srcFile% >> %logFile% 2>&1
CALL %python% --log-level ERROR --onefile ^
--hidden-import=_cffi_backend ^
--add-data mtw_utils/pyuca/*.txt;pyuca ^
--distpath %targetDir% %srcFile% >> %logFile% 2>&1

echo - Done!
echo.
Expand Down
36 changes: 36 additions & 0 deletions flask-app/!!build__mtw-server-win-worker_Py3.7.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@echo off
setlocal
echo.
set python=c:\Python37\Scripts\pyinstaller.exe
echo Build using pyinstaller : %python%
set targetDir=dist
set fileHandle=mtw-server-win-worker
set srcFile=%fileHandle%.py
set srcDir=mtw
set logFile=!build_%fileHandle%.rep

echo. > %logFile%

echo.
echo rem call %targetDir%\%fileHandle%.exe stop

echo.
echo Building %srcFile% ...

CALL %python% --log-level ERROR --onefile ^
--hidden-import=_cffi_backend --hidden-import=pkg_resources.py2_warn ^
--add-data mtw_utils/pyuca/*.txt;pyuca ^
--distpath %targetDir% %srcFile% >> %logFile% 2>&1

echo - Done!


echo.
echo rem call %targetDir%\%fileHandle%.exe install
echo.
echo rem call %targetDir%\%fileHandle%.exe start

echo Finished
echo.

endlocal
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
@echo off
setlocal
echo.
echo Build using pyinstaller
set python=c:\Programs\Python\Python38\Scripts\pyinstaller.exe
echo Build using pyinstaller : %python%
set targetDir=dist
set fileHandle=mtw-server-win-worker
set srcFile=%fileHandle%.py
set srcDir=mtw
set logFile=!build_%fileHandle%.rep

echo. > %logFile%
Expand All @@ -15,7 +17,10 @@ echo rem call %targetDir%\%fileHandle%.exe stop
echo.
echo Building %srcFile% ...

CALL c:\Python37\Scripts\pyinstaller.exe --log-level ERROR --onefile --hidden-import=_cffi_backend --hidden-import=pkg_resources.py2_warn --add-data mtw_utils/pyuca/*.txt;pyuca --distpath %targetDir% %srcFile% >> %logFile% 2>&1
CALL %python% --log-level ERROR --onefile ^
--hidden-import=_cffi_backend ^
--add-data mtw_utils/pyuca/*.txt;pyuca ^
--distpath %targetDir% %srcFile% >> %logFile% 2>&1

echo - Done!

Expand Down
21 changes: 0 additions & 21 deletions flask-app/!!build__set-mtw-admin.bat

This file was deleted.

25 changes: 25 additions & 0 deletions flask-app/!!build__set-mtw-admin_Py3.7.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@echo off
setlocal
echo.
set python=c:\Python37\Scripts\pyinstaller.exe
echo Build using pyinstaller : %python%
set targetDir=dist
set fileHandle=set-mtw-admin
set srcFile=%fileHandle%.py
set srcDir=mtw
set logFile=!build_%fileHandle%.rep

echo. > %logFile%

echo.
echo Building %srcFile% ...

CALL %python% --log-level ERROR --onefile ^
--hidden-import=_cffi_backend --hidden-import=pkg_resources.py2_warn ^
--distpath %targetDir% %srcFile% >> %logFile% 2>&1

echo.
echo Finished
echo.

endlocal
25 changes: 25 additions & 0 deletions flask-app/!!build__set-mtw-admin_Py3.8.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@echo off
setlocal
echo.
set python=c:\Programs\Python\Python38\Scripts\pyinstaller.exe
echo Build using pyinstaller : %python%
set targetDir=dist
set fileHandle=set-mtw-admin
set srcFile=%fileHandle%.py
set srcDir=mtw
set logFile=!build_%fileHandle%.rep

echo. > %logFile%

echo.
echo Building %srcFile% ...

CALL %python% --log-level ERROR --onefile ^
--hidden-import=_cffi_backend ^
--distpath %targetDir% %srcFile% >> %logFile% 2>&1

echo.
echo Finished
echo.

endlocal
1 change: 1 addition & 0 deletions flask-app/instance/cache/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## This is the MTW caching folder
4 changes: 2 additions & 2 deletions flask-app/instance/conf/mesh.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ text:TextIndexES rdfs:subClassOf text:TextIndex .
# A TDB dataset used for RDF storage
<#dataset>
a tdb2:DatasetTDB2 ;
tdb2:location "c:/Data/mesh-mtw/apache-jena-data/databases/mesh" ;
tdb2:location "e:/apache-jena-data/databases/mesh" ;
.

# Text index description
<#indexLucene>
a text:TextIndexLucene ;
text:directory "c:/Data/mesh-mtw/apache-jena-data/indexes/mesh" ;
text:directory "e:/apache-jena-data/indexes/mesh" ;
text:entityMap <#entMap> ;
text:storeValues true ;
##text:analyzer[ a text:StandardAnalyzer ] ;
Expand Down
58 changes: 41 additions & 17 deletions flask-app/instance/conf/mtw.ini
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
# -*- coding: utf-8 -*-
# *** Config version 1.0.9 ***
# *** Config version 1.1.0 ***
### Important values are marked with ! ###
### ! This file MUST BE UTF-8 encoded ! ###
### ! Restart the App after modifying ! ###
### ! Alway use forward slash: / ! ###
### ! Alway use forward slash / ! ###
### ! Use trailing slash / (if not WITHOUT)
### ! '%' char must be doubled: %% ! ###


[appconf]

### ! Required ! ###
### Host root link prefix - WITHOUT trailing slash ! ###
#HOST_LINK = http://localhost:5900

### ! Background Worker host:port ! ###
## Default - production: http://localhost:55933/ - development: http://localhost:5903/ ##
#WORKER_HOST = http://localhost:5903/
WORKER_HOST = http://localhost:55933/
WORKER_HOST = http://localhost:5903/
#WORKER_HOST = http://localhost:55933/

### ! Always set ! ###
TARGET_YEAR = 2020
TARGET_YEAR = 2021

### Default previous version year - used for showing modifications ###
PREV_YEAR_DEF = 2019
PREV_YEARS = 2015,2016,2017,2018,2019
PREV_YEAR_DEF = 2020
PREV_YEARS = 2015,2016,2017,2018,2019,2020

### Date format: YYYY-MM-DD ###
REVISED_AFTER = 2019-01-01
CREATED_AFTER = 2019-01-01
REVISED_AFTER = 2020-01-01
CREATED_AFTER = 2020-01-01

### ! Always set ! ###
MARC_LIBCODE = CZ-PrNML
Expand All @@ -33,12 +38,12 @@ MARC_MESHCODE = czmesh
### Default MARC export style ###
## line - for yaz-marcdump conversion to ISO2709 ##
## mrk - for MarcEdit conversion to ISO2709 ##
#MARC_LINE = line
#MARC_LINE = mrk

### Default MARC tree style: def OR daw ###
## def - field 072 ##
## daw - field 686 ##
#MARC_TREE = def
#MARC_TREE = daw

### Available Bootstrap themes: slate, spacelab, flatly - default: slate ###
#DEFAULT_THEME = spacelab
Expand Down Expand Up @@ -85,16 +90,35 @@ MESH_TREE = {
#SRC_DIR = D:/Data/mesh/in
#EXP_DIR = D:/Data/mesh/out


### Default management database name ###
#DATABASE_NAME = mtw.db
### Custom concept prefix - default: F ###
#PID_PREFIX_CONCEPT = F

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

### TODO (?) - currently not in use ###
##PID_PREFIX_CONCEPT = F
##PID_PREFIX_TERM = cze
### Default management database name ###
#DATABASE_NAME = mtw.db

### Default - False
DEV_DISABLE_CSRF = True

## Flask-Caching params
## See: https://flask-caching.readthedocs.io/en/latest/
## - override:
#CACHE_IGNORE_ERRORS = False
## In production use: memcached
CACHING = {"CACHE_TYPE": "filesystem", "CACHE_DEFAULT_TIMEOUT": 1800, "CACHE_THRESHOLD": 1000}
#CACHING = {"CACHE_TYPE": "memcached", "CACHE_DEFAULT_TIMEOUT": 1800, "CACHE_KEY_PREFIX": "MTWC"}

## Flask-Session params
## See: https://pythonhosted.org/Flask-Session/
## In production use: filesystem
## - and set: "SESSION_COOKIE_SECURE": true
SESSIONS = {"SESSION_COOKIE_NAME": "mtwsession", "SESSION_TYPE": "filesystem", "PERMANENT_SESSION_LIFETIME": 14400, "SESSION_KEY_PREFIX": "MTWS",
"SESSION_FILE_THRESHOLD": 1000
}

#SESSIONS = {"SESSION_COOKIE_NAME": "mtwsession", "SESSION_TYPE": "memcached", "PERMANENT_SESSION_LIFETIME": 14400, "SESSION_KEY_PREFIX": "MTWS"}


[sparqlconf]
Expand Down
1 change: 1 addition & 0 deletions flask-app/instance/sessions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## This is the MTW sessions folder
1 change: 1 addition & 0 deletions flask-app/instance/temp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## This is the MTW temp folder
1 change: 0 additions & 1 deletion flask-app/instance/temp/cache/README.md

This file was deleted.

Loading

0 comments on commit f12e654

Please sign in to comment.