-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInitialize_Project.py
31 lines (26 loc) · 1.14 KB
/
Initialize_Project.py
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
import logging.handlers
import os
import sys
from pathlib import Path
from dotenv import load_dotenv
def initialize():
my_logger = logging.getLogger('MyLogger')
my_logger.setLevel(logging.INFO)
if os.name != 'nt':
handler = logging.handlers.SysLogHandler(address='/dev/log')
my_logger.addHandler(handler)
my_logger.info('Initializing Path')
target_env_path = '/home/pi/secure' # default linux
if os.name == 'nt':
target_env_path = '\\\\SUSMANSERVER\\Active Server Drive\\HomeAutomation' # Windows
else:
sys.path.append('/home/pi/HomeAutomation-DNN') # add this to the path
sys.path.append('/home/pi/secure') # add this to the path
sys.path.append('/home/pi/Services') # add this to the path
sys.path.append('/home/pi/Helpers') # add this to the path
sys.path.append('/home/pi/Helpers/Exception_Handling') # add this to the path
sys.path.append('/home/pi/Helpers/Mongo_Interface') # add this to the path
my_logger.info('Initializing Environment')
env_path = Path(target_env_path) / '.env'
load_dotenv(dotenv_path=env_path)
return my_logger