diff --git a/scheduler/env.py b/scheduler/env.py index 1c4e629..9f13a67 100644 --- a/scheduler/env.py +++ b/scheduler/env.py @@ -1,5 +1,9 @@ from dotenv import load_dotenv import os +import pathlib + + +BASE_PATH = pathlib.Path(__file__).parent.parent.resolve() load_dotenv() @@ -8,4 +12,6 @@ def get_gmail_sender_address() -> str: def get_gmail_sender_pw() -> str: - return os.getenv("GMAIL_SENDER_PASSWORD") \ No newline at end of file + return os.getenv("GMAIL_SENDER_PASSWORD") + +print(BASE_PATH) \ No newline at end of file diff --git a/scheduler/gmail.py b/scheduler/gmail.py index e546bea..04b4944 100644 --- a/scheduler/gmail.py +++ b/scheduler/gmail.py @@ -11,7 +11,7 @@ def send_bitpoll_invitation(receivers: List[str], bitpoll_link: str): - html = load_html_template("templates/poll_invitation.html") + html = load_html_template(f"{env.BASE_PATH}/templates/poll_invitation.html") html = html.replace("YOUR_BITPOLL_LINK_HERE", bitpoll_link) send( @@ -22,7 +22,7 @@ def send_bitpoll_invitation(receivers: List[str], bitpoll_link: str): def send_schafkopf_meeting_invitation(receivers: List[str], start: datetime, bitpoll_link: str): - html = load_html_template("templates/schafkopf_scheduled.html") + html = load_html_template(f"{env.BASE_PATH}/templates/schafkopf_scheduled.html") html = html.replace("SCHEDULED_DATE_PLACEHOLDER", format_datetime(start)) html = html.replace("YOUR_BITPOLL_LINK_HERE", bitpoll_link)