Common Services mixins

Amazon AWS settings

Reads common AWS settings like AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY from environment.

AWS

class common_configs.services.aws.AWS
AWS_ACCESS_KEY_ID = SecretValue

Env variable: AWS_ACCESS_KEY_ID

AWS access key id retrieved from AWS_ACCESS_KEY_ID environment setting

AWS_SECRET_ACCESS_KEY = SecretValue

Env variable: AWS_SECRET_ACCESS_KEY

AWS secret key retrieved from AWS_SECRET_ACCESS_KEY environment setting

Use heroku config command to define the values:

heroku config:add AWS_ACCESS_KEY_ID=<key id>
heroku config:add AWS_SECRET_ACCESS_KEY=<secret key>

Cache settings

Cache config

CacheDev

class common_configs.services.cache.CacheDev

Defines list of caches for development purposes:

  • default: DummyCache
  • locmem: LocMemCache
  • dummy: DummyCache
CACHES = {u'default': {u'BACKEND': u'django.core.cache.backends.dummy.DummyCache'}, u'dummy': {u'BACKEND': u'django.core.cache.backends.dummy.DummyCache'}, u'locmem': {u'BACKEND': u'django.core.cache.backends.locmem.LocMemCache'}}

Database settings

Database

class common_configs.services.db.Database
DATABASES = DatabaseURLValue

Env variable: DATABASE_URL

Configures Django DATABASES using DATABASE_URL environment variable

Email settings

Retrieves email backend config from environment variables

Mailgun

class common_configs.services.mail.Mailgun

Use Mailgun as email backend

MAILGUN_API_KEY = SecretValue

Env variable: MAILGUN_API_KEY

Mailgun api key for using the REST API

MAILGUN_SMTP_SERVER = Value: 'smtp.mailgun.org'

Env variable: MAILGUN_SMTP_SERVER

Mailgun SMTP server host

MAILGUN_SMTP_LOGIN = SecretValue

Env variable: MAILGUN_SMTP_LOGIN

Mailgun SMTP server login

MAILGUN_SMTP_PASSWORD = SecretValue

Env variable: MAILGUN_SMTP_PASSWORD

Mailgun SMTP server password

MAILGUN_SMTP_PORT = Value: 587

Env variable: MAILGUN_SMTP_PORT

Mailgun SMTP server port

EMAIL_HOST = Value: 'smtp.mailgun.org'

Env variable: MAILGUN_SMTP_SERVER

Email host for sending mail

EMAIL_HOST_USER = SecretValue

Env variable: MAILGUN_SMTP_LOGIN

Email server username

EMAIL_HOST_PASSWORD = SecretValue

Env variable: MAILGUN_SMTP_PASSWORD

Email server password

EMAIL_PORT = Value: 587

Env variable: MAILGUN_SMTP_PORT

Email server SMTP port

EMAIL_USE_TLS = True

Email server TLS secure connection

EMAIL_BACKEND = Value: 'django.core.mail.backends.smtp.EmailBackend'

Env variable: DJANGO_EMAIL_BACKEND

Email backend

Sendgrid

class common_configs.services.mail.Sendgrid

Use Sendgrid as email backend

SENDGRID_SMTP_SERVER = Value: 'smtp.sendgrid.net'

Env variable: SENDGRID_SMTP_SERVER

Sendgrid SMTP server host

SENDGRID_USERNAME = SecretValue

Env variable: SENDGRID_USERNAME

Sendgrid SMTP server login

SENDGRID_PASSWORD = SecretValue

Env variable: SENDGRID_PASSWORD

Sendgrid SMTP server password

SENDGRID_SMTP_PORT = Value: 587

Env variable: SENDGRID_SMTP_PORT

Sendgrid SMTP server port

EMAIL_HOST = Value: 'smtp.sendgrid.net'

Env variable: SENDGRID_SMTP_SERVER

Email host for sending mail

EMAIL_HOST_USER = SecretValue

Env variable: SENDGRID_USERNAME

Email server username

EMAIL_HOST_PASSWORD = SecretValue

Env variable: SENDGRID_PASSWORD

Email server password

EMAIL_PORT = Value: 587

Env variable: SENDGRID_SMTP_PORT

Email server SMTP port

EMAIL_USE_TLS = True

Email server TLS secure connection

EMAIL_BACKEND = Value: 'django.core.mail.backends.smtp.EmailBackend'

Env variable: DJANGO_EMAIL_BACKEND

Email backend

Push notification settings

Configure push notification credentials for Apple Push Notification Service (APNS) Production/Enterprise and Google Cloud Messaging for Android (GCM)

APNS

class common_configs.services.push.APNS
APNS_PRODUCTION_SERVER = Value: 'push_production'

Env variable: APNS_PRODUCTION_SERVER

Production server

APNS_PRODUCTION_FEEDBACK_SERVER = Value: 'feedback_production'

Env variable: APNS_PRODUCTION_FEEDBACK_SERVER

Production feedback server

APNS_PRODUCTION_CERT_FILE = Value

Env variable: APNS_PRODUCTION_CERT_FILE

Production certificate file (when cert file is stored in file system)

APNS_PRODUCTION_CERT_STRING = Value

Env variable: APNS_PRODUCTION_CERT_STRING

Production certificate string (when cert is stored as env variable)

APNS_PRODUCTION_CERT_PASS = Value

Env variable: APNS_PRODUCTION_CERT_PASS

Production certificate password

APNS_ENTERPRISE_SERVER = Value: 'push_production'

Env variable: APNS_ENTERPRISE_SERVER

Enterprise server

APNS_ENTERPRISE_FEEDBACK_SERVER = Value: 'feedback_production'

Env variable: APNS_ENTERPRISE_FEEDBACK_SERVER

Enterprise feedback server

APNS_ENTERPRISE_CERT_FILE = Value

Env variable: APNS_ENTERPRISE_CERT_FILE

Enterprise certificate file (when cert file is stored in file system)

APNS_ENTERPRISE_CERT_STRING = Value

Env variable: APNS_ENTERPRISE_CERT_STRING

Enterprise certificate string (when cert is stored as env variable)

APNS_ENTERPRISE_CERT_PASS = Value

Env variable: APNS_ENTERPRISE_CERT_PASS

Enterprise certificate password

APNS_CONFIGS

Dictionary of production and enterprise settings:

{
    "production": {
        "server": ..,
        "feedback_server": ..,
        "cert_file": ..,
        "cert_string": ..,
        "cert_pass": ..,
    },
    "enterprise": ..
}
Return type:dict

GCM

class common_configs.services.push.GCM
GCM_API_KEY = SecretValue

Env variable: GCM_API_KEY

API key

GCM_DRY_RUN = BooleanValue

Env variable: GCM_DRY_RUN

Dry run flag

Pusher settings

Pusher service config

Pusher

class common_configs.services.pusherconf.Pusher
PUSHER_SOCKET_URL = Value

Env variable: PUSHER_SOCKET_URL

Pusher Socket URL

PUSHER_URL = Value

Env variable: PUSHER_URL

Pusher endpoint URL

PUSHER_APP_ID

Pusher app id from PUSHER_URL

PUSHER_KEY

Pusher key from PUSHER_URL

PUSHER_SECRET

Pusher secret from PUSHER_URL

PUSHER_HOST

Pusher host from PUSHER_URL

Sentry settings

Sentry/Raven configs

Raven

class common_configs.services.sentry.Raven
RAVEN_CONFIG = RavenDSNValue

Env variable: SENTRY_DSN

Reads Raven connection settings from SENTRY_DSN environment variable

MIDDLEWARE_CLASSES

Appends raven.contrib.django.raven_compat.middleware.Sentry404CatchMiddleware to list of MIDDLEWARE_CLASSES.

INSTALLED_APPS

Appends raven.contrib.django.raven_compat to list of INSTALLED_APPS.

Twilio settings

Twilio account config

Twilio

class common_configs.services.twilio.Twilio
TWILIO_ACCOUNT_SID = SecretValue

Env variable: TWILIO_ACCOUNT_SID

Account SID

TWILIO_AUTH_TOKEN = SecretValue

Env variable: TWILIO_AUTH_TOKEN

Auth token

TWILIO_PHONE_NUMBER = SecretValue

Env variable: TWILIO_PHONE_NUMBER

Default phone number

TWILIO_SKIP_SIGNATURE_VALIDATION = BooleanValue
TWILIO_CALLBACK_DOMAIN = Value
TWILIO_CALLBACK_USE_HTTPS = Value: True
Read the Docs v: latest
Versions
latest
Downloads
PDF
HTML
Epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.