2019-07-18 17:40:48 +00:00
|
|
|
import os
|
2019-07-30 05:19:22 +00:00
|
|
|
def get_static_dir():
|
|
|
|
return os.path.dirname(os.path.realpath(__file__)) + '/../static-data/'
|
2019-07-18 17:40:48 +00:00
|
|
|
def read_static(file, ret_bin=False):
|
2019-07-30 05:19:22 +00:00
|
|
|
static_file = get_static_dir() + file
|
2019-07-18 17:40:48 +00:00
|
|
|
|
|
|
|
if ret_bin:
|
|
|
|
mode = 'rb'
|
|
|
|
else:
|
|
|
|
mode = 'r'
|
|
|
|
with open(static_file, mode) as f:
|
2019-08-10 01:04:56 +00:00
|
|
|
data = f.read()
|
|
|
|
return data
|