Skip to content

Commit

Permalink
Added print statement to invalid settings
Browse files Browse the repository at this point in the history
  • Loading branch information
TreyWW committed Mar 22, 2024
1 parent 3b61197 commit b6a0db3
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions django_umami/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class Umami:

def check_website_settings(self):
if not self.options.host_url or not self.options.website_id:
print("Failed to send event to umami. Please set both UMAMI_PAGE_URL and UMAMI_WEBSITE_ID vars.", flush=True)
return UmamiResponse(
False, "You must set the UMAMI_PAGE_URL and UMAMI_WEBSITE_ID variables in django settings."
)
Expand Down Expand Up @@ -84,12 +85,8 @@ def track(self, event: UmamiEventData | str, event_data=None):
return UmamiResponse(success=False, message="Invalid event data")


try:
MAIN_PAGE_URL = get_setting("UMAMI_PAGE_URL", "")
MAIN_WEBSITE_ID = get_setting("UMAMI_WEBSITE_ID", "")
except AttributeError:
MAIN_PAGE_URL = None
MAIN_WEBSITE_ID = None
MAIN_PAGE_URL = get_setting("UMAMI_PAGE_URL", "")
MAIN_WEBSITE_ID = get_setting("UMAMI_WEBSITE_ID", "")

umami = Umami(options=UmamiConfig(host_url=MAIN_PAGE_URL, website_id=MAIN_WEBSITE_ID))

Expand Down

0 comments on commit b6a0db3

Please sign in to comment.