2020-08-27 10:07:46 +03:00
|
|
|
from flask import Flask
|
|
|
|
import glob
|
|
|
|
import importlib
|
|
|
|
import os
|
|
|
|
|
|
|
|
app = Flask(__name__)
|
|
|
|
|
|
|
|
current_dir = os.path.basename(os.path.dirname(__file__))
|
|
|
|
for python_file in glob.glob(current_dir + '/*.py'):
|
|
|
|
if python_file.endswith('__init__.py'):
|
|
|
|
continue
|
2021-01-14 18:14:04 +03:00
|
|
|
module_name = python_file.split('.')[0].replace(os.path.sep, '.')
|
2020-08-27 10:07:46 +03:00
|
|
|
print('loading %s' % module_name)
|
|
|
|
try:
|
|
|
|
importlib.import_module(module_name)
|
|
|
|
except ImportError as err:
|
|
|
|
print('Error:', err)
|
|
|
|
|
2020-11-08 19:52:33 +03:00
|
|
|
|
|
|
|
@app.after_request
|
|
|
|
def remove_header(response):
|
|
|
|
response.headers['Server'] = 'Flask Server'
|
2021-01-14 18:14:04 +03:00
|
|
|
return response
|