V1.30.12 initialize_app fix

This commit is contained in:
Tibor Bossanyi (Freelancer) 2021-10-03 00:21:14 +02:00
parent 1a7ce950c8
commit e19e830b4b
5 changed files with 17 additions and 5 deletions

View File

@ -1,4 +1,5 @@
import os import os
from firebase_admin import initialize_app
BACKOFFICE_VERSION = "1.30" BACKOFFICE_VERSION = "1.30"
@ -17,6 +18,9 @@ DEBUG = False
ALLOWED_HOSTS = ['62.171.188.119', "admin.aitrainer.app"] ALLOWED_HOSTS = ['62.171.188.119', "admin.aitrainer.app"]
env = os.environ['GOOGLE_APPLICATION_CREDENTIALS']
FIREBASE_APP = initialize_app()
INSTALLED_APPS = [ INSTALLED_APPS = [
'aitrainer_backoffice', 'aitrainer_backoffice',
'controlling.apps.ControllingConfig', 'controlling.apps.ControllingConfig',

View File

@ -15,6 +15,9 @@ ALLOWED_HOSTS = ['localhost', "127.0.0.1"]
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True DEBUG = True
env = os.environ['GOOGLE_APPLICATION_CREDENTIALS']
FIREBASE_APP = initialize_app()
INSTALLED_APPS = [ INSTALLED_APPS = [
'aitrainer_backoffice', 'aitrainer_backoffice',
'controlling.apps.ControllingConfig', 'controlling.apps.ControllingConfig',

View File

@ -1,4 +1,5 @@
import os import os
from firebase_admin import initialize_app
BACKOFFICE_VERSION = "1.30" BACKOFFICE_VERSION = "1.30"
@ -15,6 +16,9 @@ DEBUG = False
ALLOWED_HOSTS = ['62.171.188.119', "admin.aitrainer.app"] ALLOWED_HOSTS = ['62.171.188.119', "admin.aitrainer.app"]
env = os.environ['GOOGLE_APPLICATION_CREDENTIALS']
FIREBASE_APP = initialize_app()
INSTALLED_APPS = [ INSTALLED_APPS = [
'aitrainer_backoffice.aitrainer_backoffice', 'aitrainer_backoffice.aitrainer_backoffice',
'aitrainer_backoffice.controlling.apps.ControllingConfigLive', 'aitrainer_backoffice.controlling.apps.ControllingConfigLive',

View File

@ -1,6 +1,6 @@
import datetime import datetime
import os import os
from firebase_admin import messaging, initialize_app, exceptions from firebase_admin import messaging, exceptions
class FCM: class FCM:
logo_url = 'https://workouttest.com/wp-content/uploads/2020/10/WT_long_logo.png' logo_url = 'https://workouttest.com/wp-content/uploads/2020/10/WT_long_logo.png'
@ -9,8 +9,7 @@ class FCM:
def __init__(self): def __init__(self):
# To learn more, visit the docs here: # To learn more, visit the docs here:
# https://cloud.google.com/docs/authentication/getting-started> # https://cloud.google.com/docs/authentication/getting-started>
env = os.environ['GOOGLE_APPLICATION_CREDENTIALS'] pass
default_app = initialize_app()
def send_to_multiple_token(self, title, body, registration_token, image_url = None): def send_to_multiple_token(self, title, body, registration_token, image_url = None):
try: try:

View File

@ -14,8 +14,9 @@ import traceback
class Notification: class Notification:
fcm = None fcm = None
def __init__(self) -> None: def __init__(self) -> None:
self.fcm = FCM() if self.fcm == None:
self.fcm = FCM()
def run(self): def run(self):
print("** Running Notification automation") print("** Running Notification automation")
@ -56,3 +57,4 @@ class Notification:
history.notification_date = datetime.datetime.now(tz=cet) history.notification_date = datetime.datetime.now(tz=cet)
history.save() history.save()
print(f'-- Notification History "{history}" has been saved') print(f'-- Notification History "{history}" has been saved')