Add django-dbsettings requirement
Move Telegram bot token to dbsettings (incl. migration)
This commit is contained in:
parent
82e563cab6
commit
3ae64b5caf
|
@ -15,6 +15,7 @@ INSTALLED_APPS = [
|
||||||
'django.contrib.messages',
|
'django.contrib.messages',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
'colorfield',
|
'colorfield',
|
||||||
|
'dbsettings',
|
||||||
'common',
|
'common',
|
||||||
'frontend',
|
'frontend',
|
||||||
'mood',
|
'mood',
|
||||||
|
@ -124,8 +125,3 @@ LOGOUT_REDIRECT_URL = "/"
|
||||||
|
|
||||||
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage' if not AWS_ACCESS_KEY_ID else 'storages.backends.s3boto3.S3Boto3Storage'
|
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'
|
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
|
|
|
@ -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_NAME = None # Name of the database to be used
|
||||||
DB_USER = None # User name to authenticate with
|
DB_USER = None # User name to authenticate with
|
||||||
DB_PASS = None # Password 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
|
|
|
@ -1,4 +1,3 @@
|
||||||
from django.conf import settings
|
|
||||||
from django.views.generic import View
|
from django.views.generic import View
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
|
|
||||||
|
@ -6,6 +5,8 @@ import json
|
||||||
|
|
||||||
import telegram
|
import telegram
|
||||||
|
|
||||||
|
from dbsettings.functions import dbsettings
|
||||||
|
|
||||||
from ..signals import send_message
|
from ..signals import send_message
|
||||||
from ..models import GatewayUser
|
from ..models import GatewayUser
|
||||||
|
|
||||||
|
@ -14,7 +15,7 @@ class TelegramWebhookView(View):
|
||||||
pass # TODO: Implement webhook receiver and management tool
|
pass # TODO: Implement webhook receiver and management tool
|
||||||
|
|
||||||
class TelegramDispatcher:
|
class TelegramDispatcher:
|
||||||
def __init__(self, token=settings.TELEGRAM_TOKEN):
|
def __init__(self, token=dbsettings.TELEGRAM_TOKEN):
|
||||||
self.bot = telegram.Bot(token=token)
|
self.bot = telegram.Bot(token=token)
|
||||||
|
|
||||||
def send(self, message, chat_id):
|
def send(self, message, chat_id):
|
||||||
|
|
|
@ -5,6 +5,7 @@ django-colorfield
|
||||||
django-multiupload
|
django-multiupload
|
||||||
django-storages
|
django-storages
|
||||||
git+git://github.com/Chive/django-multiupload.git@ba52e161a68ce19062c3655e89544c2d377990a0#egg=multiupload
|
git+git://github.com/Chive/django-multiupload.git@ba52e161a68ce19062c3655e89544c2d377990a0#egg=multiupload
|
||||||
|
git+https://kumig.it/kumisystems/django-dbsettings.git
|
||||||
mysqlclient
|
mysqlclient
|
||||||
boto3
|
boto3
|
||||||
argon2_cffi
|
argon2_cffi
|
||||||
|
|
Loading…
Reference in a new issue