Пример #1
0
 def handle(self, *args, **options):
     email = options['email'][0]
     password = options['password'][0]
     create_public_tenant(config('DOMAIN_NAME'), email)
     UserModel = get_user_model()
     user = UserModel.objects.filter(email=email).first()
     if user:
         user.set_password(password)
         user.save()
Пример #2
0
# -*- coding: utf-8 -*-
from server.settings.components import config
# Caching
# https://docs.djangoproject.com/en/2.2/topics/cache/

CACHES = {
    'default': {
        'BACKEND': 'django_redis.cache.RedisCache',
        'LOCATION': config('REDIS_LOC'),
        'OPTIONS': {
            'CLIENT_CLASS': 'django_redis.client.DefaultClient'
        },
        'KEY_PREFIX': 'morattendance'
    },
    'axes_cache': {
        'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
    },
}

# django-axes
# https://django-axes.readthedocs.io/en/latest/configuration.html
# See #known-configuration-problems section

AXES_CACHE = 'axes_cache'
Пример #3
0
SECURITY WARNING: don't run with debug turned on in production!
"""

import logging
from typing import List

from server.settings.components import config
from server.settings.components.common import INSTALLED_APPS, MIDDLEWARE

# Setting the development status:

DEBUG = True

ALLOWED_HOSTS = [
    config("DOMAIN_NAME"),
    "localhost",
    "0.0.0.0",  # noqa: S104
    "127.0.0.1",
    "[::1]",
]

# Installed apps for developement only:

INSTALLED_APPS += (
    "debug_toolbar",
    "nplusone.ext.django",
    "django_migration_linter",
    "django_test_migrations.contrib.django_checks.AutoNames",
)
Пример #4
0
from server.settings.components import config

COGNITO_USER_POOL_ID = config("COGNITO_USER_POOL_ID")
COGNITO_APP_ID = config("COGNITO_APP_ID")
COGNITO_APP_SECRET = config("COGNITO_APP_SECRET")
COGNITO_DOMAIN = config("COGNITO_DOMAIN")

AWS_ACCESS_KEY_ID = config("AWS_ACCESS_KEY_ID")
AWS_SECRET_ACCESS_KEY = config("AWS_SECRET_ACCESS_KEY")
AWS_DEFAULT_REGION = config("AWS_DEFAULT_REGION")

COGNITO_CREATE_UNKNOWN_USERS = True

# that's from django-allauth settings
SITE_ID = 1

ACCOUNT_USER_MODEL_USERNAME_FIELD = None
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_USERNAME_REQUIRED = False
ACCOUNT_AUTHENTICATION_METHOD = "email"

SOCIALACCOUNT_STORE_TOKENS = True

SOCIALACCOUNT_PROVIDERS = {
    "amazon_cognito": {
        "DOMAIN": f"https://{COGNITO_DOMAIN}.auth.{AWS_DEFAULT_REGION}.amazoncognito.com",
        "APP": {
            "client_id": COGNITO_APP_ID,
            "secret": COGNITO_APP_SECRET,
        },
        "SCOPE": ["email", "profile", "openid"],
Пример #5
0
This file contains all the settings used in production.

This file is required and if development.py is present these
values are overridden.
"""

from server.settings.components import config

# Production flags:
# https://docs.djangoproject.com/en/2.2/howto/deployment/

DEBUG = False

ALLOWED_HOSTS = [
    # TODO: check production hosts
    config('DOMAIN_NAME'),
    'ticket.rfedorov.ru',

    # We need this value for `healthcheck` to work:
    'localhost',
]

# Staticfiles
# https://docs.djangoproject.com/en/2.2/ref/contrib/staticfiles/

# This is a hack to allow a special flag to be used with `--dry-run`
# to test things locally.
_COLLECTSTATIC_DRYRUN = config(
    'DJANGO_COLLECTSTATIC_DRYRUN',
    cast=bool,
    default=False,
Пример #6
0
https://docs.djangoproject.com/en/2.2/topics/settings/

For the full list of settings and their config, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""

from typing import Dict, List, Tuple, Union

from django.utils.translation import ugettext_lazy as ugt

from server.settings.components import BASE_DIR, config

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

SECRET_KEY = config('DJANGO_SECRET_KEY')

# Application definition:

INSTALLED_APPS: Tuple[str, ...] = (
    # Default django apps:
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    # Jet Django
    'jet_django',

    # Jet Dashboard
Пример #7
0
SECURITY WARNING: don't run with debug turned on in production!
"""

import logging
from typing import List

from server.settings.components import config
from server.settings.components.common import INSTALLED_APPS, MIDDLEWARE

# Setting the development status:

DEBUG = True

ALLOWED_HOSTS = [
    config('DOMAIN_NAME'),
    'localhost',
    '0.0.0.0',  # noqa: S104
    '127.0.0.1',
    '[::1]',
]

# Installed apps for developement only:

INSTALLED_APPS += (
    'debug_toolbar',
    'nplusone.ext.django',
    'django_migration_linter',
    'django_test_migrations.contrib.django_checks.AutoNames',
)
Пример #8
0
This file contains all the settings used in production.

This file is required and if development.py is present these
values are overridden.
"""

from server.settings.components import config

# Production flags:
# https://docs.djangoproject.com/en/2.2/howto/deployment/

DEBUG = False

ALLOWED_HOSTS = [
    # TODO: check production hosts
    config('DOMAIN_NAME'),

    # We need this value for `healthcheck` to work:
    'localhost',
]

CSRF_TRUSTED_ORIGINS = [config('DOMAIN_NAME')]

# Staticfiles
# https://docs.djangoproject.com/en/2.2/ref/contrib/staticfiles/

# This is a hack to allow a special flag to be used with `--dry-run`
# to test things locally.
_COLLECTSTATIC_DRYRUN = config(
    'DJANGO_COLLECTSTATIC_DRYRUN',
    cast=bool,
Пример #9
0
    'nplusone.ext.django',
)

INSTALLED_APPS = DEV_INSTALLED_APPS + INSTALLED_APPS

MIDDLEWARE += (
    'debug_toolbar.middleware.DebugToolbarMiddleware',

    # https://github.com/bradmontgomery/django-querycount
    # Prints how many queries were executed, useful for the APIs.
    'querycount.middleware.QueryCountMiddleware',
)

# Workaround for django-debug-toolbar, use by default TESTING_MODE=False and we
# will show debug toolbar otherwise TESTING_MODE=True and don't show
TESTING_MODE = config('TESTING_MODE', cast=bool, default=False)


def custom_show_toolbar(request):
    """Only show the debug toolbar to users with the superuser flag."""
    return not TESTING_MODE


DEBUG_TOOLBAR_CONFIG = {
    'SHOW_TOOLBAR_CALLBACK':
    'server.settings.environments.development.custom_show_toolbar',
}

DEBUG_TOOLBAR_PANELS = PANELS_DEFAULTS + [
    'debug_toolbar.panels.profiling.ProfilingPanel',
]
Пример #10
0
https://docs.djangoproject.com/en/2.2/topics/settings/

For the full list of settings and their config, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""

from typing import Dict, List, Tuple, Union

from django.utils.translation import ugettext_lazy as _

from server.settings.components import BASE_DIR, config

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

SECRET_KEY = config('DJANGO_SECRET_KEY')
TELEGRAM_TOKEN = config('TELEGRAM_TOKEN')
TELEGRAM_WEBHOOK_SECRET = config('TELEGRAM_WEBHOOK_SECRET')

# Application definition:

INSTALLED_APPS: Tuple[str, ...] = (
    # Your apps go here:
    'server.apps.bot',

    # Default django apps:
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
Пример #11
0
https://docs.djangoproject.com/en/2.2/topics/settings/

For the full list of settings and their config, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""

from typing import Tuple

from django.utils.translation import ugettext_lazy as ugt

from server.settings.components import BASE_DIR, config

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

SECRET_KEY = config("SECRET_KEY")

# Application definition:

INSTALLED_APPS: Tuple[str, ...] = (
    # Your apps go here:
    "server.apps.accounts.apps.AccountsConfig",
    "server.apps.resumes.apps.ResumesConfig",
    # Default django apps:
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    # django-admin:
    "django.contrib.admin",
Пример #12
0
https://docs.djangoproject.com/en/2.2/topics/settings/

For the full list of settings and their config, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""

from typing import Dict, List, Tuple, Union

from django.utils.translation import ugettext_lazy as ugt

from server.settings.components import BASE_DIR, config

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

SECRET_KEY = config('DJANGO_SECRET_KEY', 'test')

# Application definition:

INSTALLED_APPS: Tuple[str, ...] = (
    # Your apps go here:
    'server.apps.main',

    # Default django apps:
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    # django-admin:
Пример #13
0
https://docs.djangoproject.com/en/2.2/topics/settings/

For the full list of settings and their config, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""

from typing import Dict, List, Tuple, Union

from django.utils.translation import ugettext_lazy as _

from server.settings.components import BASE_DIR, config

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

SECRET_KEY = config('DJANGO_SECRET_KEY')

OPENHUMANS_APP_BASE_URL = config('OPENHUMANS_APP_BASE_URL')
OPENHUMANS_CLIENT_ID = config('OPENHUMANS_CLIENT_ID')
OPENHUMANS_CLIENT_SECRET = config('OPENHUMANS_CLIENT_SECRET')

# After log in, send users to the confirm page.
LOGIN_REDIRECT_URL = 'main:confirm_page'

# Project's page on Open Humans
OH_PROJ_PAGE = config('OH_PROJ_PAGE')

# Application definition:

INSTALLED_APPS: Tuple[str, ...] = (
Пример #14
0
from server.settings.components import config
from server.settings.components.common import (
    INSTALLED_APPS,
    MIDDLEWARE,
    GRAPHENE,
)  # noqa

# Setting the development status:

DEBUG = True

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.postgresql_psycopg2",
        "NAME": config("POSTGRES_DB"),
        "USER": config("POSTGRES_USER"),
        "PASSWORD": config("POSTGRES_PASSWORD"),
        "HOST": config("DJANGO_DATABASE_HOST"),
        "PORT": config("DJANGO_DATABASE_PORT", cast=int),
        "CONN_MAX_AGE": config("CONN_MAX_AGE", cast=int, default=60),
        "OPTIONS": {
            "connect_timeout": 10
        },
    }
}

ALLOWED_HOSTS = [config("DOMAIN_NAME"), "localhost", "127.0.0.1", "[::1]"]

# Static files:
# https://docs.djangoproject.com/en/2.2/ref/settings/#std:setting-STATICFILES_DIRS
Пример #15
0
https://docs.djangoproject.com/en/1.11/topics/settings/

For the full list of settings and their config, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""

import os

from server.settings.components import BASE_DIR, config  # NOQA

# Build paths inside the project like this: join(BASE_DIR, ...)

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

SECRET_KEY = config('DJANGO_SECRET_KEY')

# Application definition:

INSTALLED_APPS = (
    # Default django apps:
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    # django-admin:
    'django.contrib.admin',
    'django.contrib.admindocs',
Пример #16
0
SECURITY WARNING: don't run with debug turned on in production!
"""

import logging
import pathlib
from typing import List

from server.settings.components import config
from server.settings.components.common import INSTALLED_APPS, MIDDLEWARE

# Setting the development status:

DEBUG = True

ALLOWED_HOSTS = [
    config('DOMAIN_NAME', 'localhost'),
    'localhost',
    '0.0.0.0',  # noqa: S104
    '127.0.0.1',
    '[::1]',
]

# Installed apps for developement only:

INSTALLED_APPS += (
    'debug_toolbar',
    'nplusone.ext.django',
    'django_migration_linter',
    'django_test_migrations.contrib.django_checks.AutoNames',
)
Пример #17
0
Django settings for server project.

For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/

For the full list of settings and their config, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
from typing import Tuple
from server.settings.components import BASE_DIR, config

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

SECRET_KEY = config('DJANGO_SECRET_KEY')

# Application definition:
SHARED_APPS: Tuple[str, ...] = (
    'tenant_schemas',  # mandatory, should always be before any django app
    'django.contrib.auth',  # Defined in both shared apps and tenant apps
    'django.contrib.contenttypes',  # Defined in both shared apps and tenant apps
    'tenant_users.permissions',  # Defined in both shared apps and tenant apps
    'tenant_users.tenants',  # defined only in shared apps
    'server.tenants',  # Custom defined app that contains the TenantModel. Must NOT exist in TENANT_APPS
    'server.accounts',  # Custom app that contains the new User Model (see below). Must NOT exist in TENANT_APPS
    'django.contrib.sessions',

    # django-admin:
    'django.contrib.admin',
    'django.contrib.admindocs',
Пример #18
0
This file contains all the settings used in production.

This file is required and if development.py is present these
values are overridden.
"""

from server.settings.components import config

# Production flags:
# https://docs.djangoproject.com/en/2.2/howto/deployment/

DEBUG = False

ALLOWED_HOSTS = [
    # TODO: check production hosts
    config("DOMAIN_NAME"),
    # We need this value for `healthcheck` to work:
    "localhost",
]


# Staticfiles
# https://docs.djangoproject.com/en/2.2/ref/contrib/staticfiles/

# This is a hack to allow a special flag to be used with `--dry-run`
# to test things locally.
_COLLECTSTATIC_DRYRUN = config(
    "DJANGO_COLLECTSTATIC_DRYRUN",
    cast=bool,
    default=False,
)
Пример #19
0
https://docs.djangoproject.com/en/2.2/topics/settings/

For the full list of settings and their config, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""

from typing import Dict, List, Tuple, Union

from django.utils.translation import ugettext_lazy as _

from server.settings.components import BASE_DIR, config

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

SECRET_KEY = config("DJANGO_SECRET_KEY")

# Application definition:

INSTALLED_APPS: Tuple[str, ...] = (
    # Your apps go here:
    "server.apps.main",
    # Default django apps:
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.sites",
    "django.contrib.staticfiles",
    # django-admin:
    "django.contrib.admin",
Пример #20
0
"""
This is a django-split-settings main file.

For more information read this:
https://github.com/sobolevn/django-split-settings

To change settings file:
`DJANGO_ENV=production python manage.py runserver`
"""

from split_settings.tools import include

from server.settings.components import config

base_settings = [
    'components/common.py',
    'components/logging.py',
    'components/security.py',
    'components/caches.py',

    # You can even use glob:
    # 'components/*.py'

    # Select the right env:
    'environments/{0}.py'.format(config('DJANGO_ENV', default='development')),
]

# Include settings:
include(*base_settings)
Пример #21
0
https://docs.djangoproject.com/en/2.2/topics/settings/

For the full list of settings and their config, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""

from typing import Dict, List, Optional, Tuple, Union

from django.utils.translation import ugettext_lazy as ugt

from server.settings.components import BASE_DIR, config

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

SECRET_KEY = config('DJANGO_SECRET_KEY')
AUTH_USER_MODEL = 'main.User'
API_AUTH_KEY = config('API_AUTH_SECRET_KEY')  # using in API calls

# Application definition:

INSTALLED_APPS: Tuple[str, ...] = (
    # Your apps go here:
    'server.apps.main',

    # Default django apps:
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
Пример #22
0
"""
Django settings for server project.

For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/

For the full list of settings and their config, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
from server.settings.components import BASE_DIR, config

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

DEBUG = config('DEBUG', cast=bool, default=False)

SECRET_KEY = config('SECRET_KEY')

# Application definition:

INSTALLED_APPS = (
    # Your apps go here:
    'pdf_app',

    # Default django apps:
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',