Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

import application 

import pathlib 

import sys 

import flask 

import tempfile 

 

def create_app(**kwargs): 

""" 

Creates a Flask app and temporary folders. If the scripts were frozen with 

PyInstaller, the paths to the template and static folder are adjusted 

accordingly. 

""" 

dumpdir, archivedir = application.utils.get_tempdirs(make=True) 

 

if getattr(sys, "frozen", False): 

root = pathlib.Path(sys._MEIPASS) 

app = flask.Flask(import_name=__name__, 

template_folder=str(pathlib.Path(root, "templates")), 

static_folder=str(pathlib.Path(root, "static")), 

**kwargs) 

else: 

app = flask.Flask(import_name=__name__, **kwargs) 

return app, str(dumpdir), str(archivedir)