def send_notification_to_seller(order, text, title):
    tokens = FirebaseToken.objects.filter(user=order.client.user)
    tokens_array = []
    for token in tokens:
        if token.is_seller:
            tokens_array.append(token.token)

    payload = {
        "Authorization": "key=" + get_env_variable('FIREBASE_TOKEN'),
        "Content-Type": "application/json"
    }
    data = {
        "registration_ids": tokens_array,
        "notification": {
            "title": title,
            "body": text
        }
    }.__str__().replace('\'', '"')
    requests.post('https://fcm.googleapis.com/fcm/send',
                  data=data,
                  headers=payload)
Beispiel #2
0
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = 'U8WDeC2DqmOzAN5qV7NFme3H'
SOCIAL_AUTH_URL_NAMESPACE = 'social'

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '9e+mjri=s6f0ttenw4wkligc3o!i%s__9()rv6uykt%krkp(j7'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ['*']

DEFAULT_FILE_STORAGE = 'storages.backends.dropbox.DropBoxStorage'
DROPBOX_OAUTH2_TOKEN = get_env_variable('DROPBOX_OAUTH2_TOKEN')
AJAX_ACTIVE = get_env_variable('AJAX_ACTIVE')
MELI_TOKEN = get_env_variable('MELI_TOKEN')

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'social_django',
    'crispy_forms',
    'bootstrap4',
    'cloudinary',
    'core',
Beispiel #3
0
import os
from django.utils.translation import ugettext_lazy as _
from utils.env import get_env_variable

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(
    os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = get_env_variable('SECRET_KEY')

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'supplier_app',
    'users_app',
    'social_django',
    'invoices_app',
    'bootstrap_datepicker_plus',
    'pure_pagination',
    'simple_history',
    'django_filters',
    'djcelery',
    "djcelery_email",
Beispiel #4
0
from .base import *  # noqa
from utils.env import get_env_variable

ALLOWED_HOSTS = ['localhost', '127.0.0.1']

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),  # noqa
    }
}

SOCIAL_AUTH_EVENTBRITE_KEY = get_env_variable('SOCIAL_AUTH_EVENTBRITE_KEY')
SOCIAL_AUTH_EVENTBRITE_SECRET = get_env_variable(
    'SOCIAL_AUTH_EVENTBRITE_SECRET')

SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = get_env_variable(
    'SOCIAL_AUTH_GOOGLE_OAUTH2_KEY')
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = get_env_variable(
    'SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET')

DEFAULT_FILE_STORAGE = 'storages.backends.dropbox.DropBoxStorage'
DROPBOX_OAUTH2_TOKEN = get_env_variable('DROPBOX_OAUTH2_TOKEN')

DEBUG = True
CELERY_ALWAYS_EAGER = True
    'britesu-qa.herokuapp.com',
]

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'supplier_management_site',
        'USER': '******',
        'PASSWORD': '',
        'PORT': '',
    }
}

STATIC_ROOT = os.path.join(BASE_DIR, 'static_prod')

SOCIAL_AUTH_EVENTBRITE_KEY = get_env_variable('SOCIAL_AUTH_EVENTBRITE_KEY')
SOCIAL_AUTH_EVENTBRITE_SECRET = get_env_variable(
    'SOCIAL_AUTH_EVENTBRITE_SECRET')

SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = get_env_variable(
    'SOCIAL_AUTH_GOOGLE_OAUTH2_KEY')
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = get_env_variable(
    'SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET')

INSTALLED_APPS += [  # noqa
    'whitenoise.runserver_nostatic'
]

MIDDLEWARE += [  # noqa
    'whitenoise.middleware.WhiteNoiseMiddleware'
]