'colorado.apps.news', ) # aws AWS_ACCESS_KEY_ID = env('AWS_ACCESS_KEY_ID') AWS_SECRET_ACCESS_KEY = env('AWS_SECRET_ACCESS_KEY') AWS_STORAGE_BUCKET_NAME = env('AWS_STORAGE_BUCKET_NAME') AWS_S3_SECURE_URLS = False AWS_QUERYSTRING_AUTH = False # api API_LIMIT_PER_PAGE = 0 TASTYPIE_FULL_DEBUG = True # caching and redis REDIS = dj_redis_url.config(default='redis://localhost:6379') CACHES = { 'default': { 'BACKEND': 'redis_cache.RedisCache', 'LOCATION': '%(HOST)s:%(PORT)s' % REDIS, 'OPTIONS': { 'DB': REDIS['DB'], 'PASSWORD': REDIS['PASSWORD'], 'PARSER_CLASS': 'redis.connection.HiredisParser' }, }, } CACHE_MIDDLEWARE_SECONDS = 0 CACHE_MIDDLEWARE_KEY_PREFIX = "coguns"
# TODO check if will be needed in production SWAGGER_API_PREFIX = "" FIXTURE_DIRS = ("/help/fixtures/", "/app/fixtures/") MEDIA_URL = "/" EXTERNAL_ADDRESS_PROVIDER = ExternalProviderRepVirtual # For django-websocket-redis WEBSOCKET_URL = '/ws/' WS4REDIS_HEARTBEAT = '--heartbeat--' if os.environ.get('REDIS_URL') is not None: WS4REDIS_CONNECTION = dj_redis_url.config() # Time to store message (default is 3600) WS4REDIS_EXPIRE = 60 # Prefix to store objects in redis. Should be used if the server is shared with other applications # WS4REDIS_PREFIX = 'ws' # Change redis subscriber implementation. Default is ws4redis.subscriber.RedisSubscriber # WS4REDIS_SUBSCRIBER = 'myapp.subscriber.RedisSubscriber' # Needed in debug only and ignored in production. # Overrides Django’s internal main loop and adds a URL dispatcher in front of the request handler WSGI_APPLICATION = 'ws4redis.django_runserver.application' # Should be implemented a callback to restrict access to the channels
# Nicks requested to be excluded from logging EXCLUDE_NICKS = os.environ.get('EXCLUDE_NICKS', '').split(',') if EXCLUDE_NICKS == ['']: EXCLUDE_NICKS = [] REDIS_PLUGIN_QUEUE_URL = os.environ.get('REDIS_PLUGIN_QUEUE_URL', 'redis://localhost:6379/0') REDIS_PLUGIN_STORAGE_URL = os.environ.get('REDIS_PLUGIN_STORAGE_URL', 'redis://localhost:6379/1') #============================================================================== # Third party app settings #============================================================================== SOUTH_DATABASE_ADAPTERS = {'default': 'south.db.postgresql_psycopg2'} REDIS_SSEQUEUE = dj_redis_url.config('REDIS_SSEQUEUE_URL', 'redis://localhost:6379/2') REDIS_SSEQUEUE_CONNECTION_SETTINGS = { 'location': '{HOST}:{PORT}'.format(**REDIS_SSEQUEUE), 'password': REDIS_SSEQUEUE['PASSWORD'], 'db': REDIS_SSEQUEUE['DB'], } SOCIAL_AUTH_USER_MODEL = AUTH_USER_MODEL SOCIAL_AUTH_PROTECTED_USER_FIELDS = ['email'] SOCIAL_AUTH_DEFAULT_USERNAME = '******' SOCIAL_AUTH_ASSOCIATE_BY_MAIL = True SOCIAL_AUTH_NEW_USER_REDIRECT_URL = '/accounts/manage/'
import dj_redis_url from aiogram.contrib.fsm_storage.redis import RedisStorage2 import configs redis_config: dict = dj_redis_url.config(default=configs.REDIS_URL) def parse_config(config_to_parse: dict) -> dict: """ Parses redis_config for RedisStorage2 by lowering keys Structure of redis_config: >>> redis_config.keys() dict_keys(['DB', 'PASSWORD', 'HOST', 'PORT']) :return: dict """ return dict((k.lower(), v) for k, v in config_to_parse.items()) # Following to the structure above it's better to write this expression redis_storage = RedisStorage2(**parse_config(redis_config))
def patch_redis(g): g.setdefault('REDIS', {}).setdefault('') g['REDIS'] = {"default": dj_redis_url.config()}
'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'config.wsgi.application' REDIS = {"default": dj_redis_url.config()} # Database # https://docs.djangoproject.com/en/2.2/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'mydatabase', } } # Password validation # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [