diff --git a/kumify/settings.py b/kumify/settings.py index f8e2427..f058a9e 100644 --- a/kumify/settings.py +++ b/kumify/settings.py @@ -15,6 +15,7 @@ INSTALLED_APPS = [ 'django.contrib.messages', 'django.contrib.staticfiles', 'colorfield', + 'dbsettings', 'common', 'frontend', 'mood', @@ -123,9 +124,4 @@ LOGIN_REDIRECT_URL = '/' LOGOUT_REDIRECT_URL = "/" DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage' if not AWS_ACCESS_KEY_ID else 'storages.backends.s3boto3.S3Boto3Storage' -STATICFILES_STORAGE = 'storages.backends.s3boto3.S3StaticStorage' if AWS_ACCESS_KEY_ID else 'django.contrib.staticfiles.storage.StaticFilesStorage' - -try: - assert TELEGRAM_TOKEN -except NameError: - TELEGRAM_TOKEN = None \ No newline at end of file +STATICFILES_STORAGE = 'storages.backends.s3boto3.S3StaticStorage' if AWS_ACCESS_KEY_ID else 'django.contrib.staticfiles.storage.StaticFilesStorage' \ No newline at end of file diff --git a/localsettings.dist.py b/localsettings.dist.py index f846d59..179305e 100644 --- a/localsettings.dist.py +++ b/localsettings.dist.py @@ -40,7 +40,3 @@ DB_PORT = 3306 # Port of the database server - the default value usually works DB_NAME = None # Name of the database to be used DB_USER = None # User name to authenticate with DB_PASS = None # Password to authenticate with - -# If you wish to enable the Telegram gateway to send and receive messages, enter the token you have received from the @BotFather here. - -TELEGRAM_TOKEN = None \ No newline at end of file diff --git a/msgio/gateways/telegram.py b/msgio/gateways/telegram.py index 7c8c907..d2d7bdb 100644 --- a/msgio/gateways/telegram.py +++ b/msgio/gateways/telegram.py @@ -1,4 +1,3 @@ -from django.conf import settings from django.views.generic import View from django.dispatch import receiver @@ -6,6 +5,8 @@ import json import telegram +from dbsettings.functions import dbsettings + from ..signals import send_message from ..models import GatewayUser @@ -14,7 +15,7 @@ class TelegramWebhookView(View): pass # TODO: Implement webhook receiver and management tool class TelegramDispatcher: - def __init__(self, token=settings.TELEGRAM_TOKEN): + def __init__(self, token=dbsettings.TELEGRAM_TOKEN): self.bot = telegram.Bot(token=token) def send(self, message, chat_id): diff --git a/requirements.txt b/requirements.txt index 9008f88..83c68f8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,6 +5,7 @@ django-colorfield django-multiupload django-storages git+git://github.com/Chive/django-multiupload.git@ba52e161a68ce19062c3655e89544c2d377990a0#egg=multiupload +git+https://kumig.it/kumisystems/django-dbsettings.git mysqlclient boto3 argon2_cffi