-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusint
executable file
·38 lines (36 loc) · 1.46 KB
/
usint
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import sys
import os
from email.mime.text import MIMEText
from subprocess import Popen, PIPE
from datetime import datetime
#
# --- Path Settings
# --- For finding the application scripts in directory where this file copy is located.
#
sys.path.insert(0, f"{os.path.dirname(os.path.realpath(__file__))}")
sys.path.insert(1, f"{os.path.dirname(os.path.realpath(__file__))}/cus_app")
sys.path.append(
"/soft/SYBASE16.0/OCS-16_0/python/python311_64r/lib"
) #: For importing the sybpydb python package
#
# --- Determine the configuration when creating the application
#
_CONFIGURATION_NAME = "localhost"
_ADMINS = ["[email protected]"]
#
# --- Application imports and running
#
from cus_app import create_app #: in app/__init__.py
if os.getenv("FLASK_RUN_FROM_CLI") is None and _CONFIGURATION_NAME == "localhost":
#
# --- In this instance, the application is running on an apache web server but the configuration in this file copy was not changed.
#
msg = MIMEText(f"Error in config selection: {_CONFIGURATION_NAME} from {os.path.realpath(__file__)}")
msg["From"] = "UsintErrorHandler"
msg["To"] = ",".join(_ADMINS)
msg["Subject"] = f"Usint Error-[{datetime.now().strftime('%c')}]"
p = Popen(["/sbin/sendmail", "-t", "-oi"], stdin=PIPE)
p.communicate(msg.as_bytes())
raise Exception(f"Error in config selection: {_CONFIGURATION_NAME} from {os.path.realpath(__file__)}")
else:
application = create_app(_CONFIGURATION_NAME)