Deployment¶
For an example of how to deploy the application, see knowmetools/km-api-deployment.
Environment Variables¶
The following environment variables can be used to modify the application’s behavior.
Note
The application will only attempt to use a Postgres database if all of DJANGO_DB_HOST
, DJANGO_DB_NAME
, DJANGO_DB_PASSWORD
, DJANGO_DB_PORT
, and DJANGO_DB_USER
are set. If any of these settings are not provided, we fall back to a local SQLite database.
DJANGO_ALLOWED_HOSTS¶
Default: ''
A comma separated list of allowed hosts.
Note
This must be set if DJANGO_DEBUG
is set to False
.
DJANGO_APPLE_RECEIPT_VALIDATION_ENDPOINT¶
Default: https://sandbox.itunes.apple.com/verifyReceipt
The endpoint used to verify subscription receipts from Apple. This can take one of two values:
https://sandbox.itunes.apple.com/verifyReceipt
https://buy.itunes.apple.com/verifyReceipt
DJANGO_DB_PASSWORD¶
Default:: ''
The password of the user that the application connects to the Postgres database as.
DJANGO_EMAIL_VERIFICATION_URL¶
Default: https://example.com/verify/{key}'
The template used to construct links for verifying a user’s email address. The {key}
portion of the template will be replaced with a unique token.
DJANGO_HTTPS¶
Default: False
Set to True
(case insensitive) if the application is served over HTTPS.
DJANGO_HTTPS_LOAD_BALANCER¶
Default: False
Set to True
(case insensitive) if the application is served over HTTPS but is located behind a load balancer that terminates SSL. If this is enabled, requests with the header HTTP_X_FORWARDED_PROTO
set to https
will be treated as if they came in over HTTPS.
Note
This has no effect unless DJANGO_HTTPS is set to True
.
DJANGO_IN_MEMORY_FILES¶
Default: False
Set to True
(case insensitive) to store static files in memory. This is mainly used for testing.
DJANGO_MEDIA_ROOT¶
Default: ''
The location on the server’s filesystem to store user uploaded files at. This setting has no effect when DJANGO_S3_STORAGE
is True
.
DJANGO_PASSWORD_RESET_URL¶
Default: https://example.com/reset/{key}
The template used to construct password reset links. The {key}
portion of the template will be replaced with a unique token.
DJANGO_RUNNING_ON_ECS¶
Default: False
A boolean indicating if the application is running as an ECS task. If it is, the application automatically adds the private IP of the ECS task to the list of allowed hosts.
DJANGO_S3_AWS_REGION¶
Default: $DJANGO_AWS_REGION
The AWS region that the S3 bucket used to store files is located in. Only takes effect when DJANGO_S3_STORAGE
is True
.
DJANGO_S3_BUCKET¶
Default: ''
The name of the S3 bucket to store files in. Only takes effect when DJANGO_S3_STORAGE
is True
.
DJANGO_S3_STORAGE¶
Default: False
Set to True
(case insensitive) to enable storage of static and user uploaded files in an S3 bucket. Requires the following settings to be provided:
DJANGO_S3_BUCKET
DJANGO_SECRET_KEY¶
Default: secret
Warning
The default value is only used if DJANGO_DEBUG
is set to True
. This is to avoid exposing a known secret key in a production environment.
The secret key that Django uses for a few security operations.
DJANGO_SENTRY_DSN¶
Default: ''
The Data Source Name for the application’s Sentry project. If provided logging of warnings and errors to Sentry is enabled.
DJANGO_SENTRY_ENVIRONMENT¶
Default: default
The name of the environment that should be provided as context when logging to Sentry. Only takes effect when DJANGO_SENTRY_DSN
is provided.
DJANGO_SENTRY_RELEASE¶
Default: unknown
An identifier sent with all events to Sentry that lets us identify which version of the application caused the issue.
DJANGO_SES_AWS_REGION¶
Default: $DJANGO_AWS_REGION
The AWS region to send SES emails from. Only takes effect when DJANGO_SES_ENABLED
is True
.
DJANGO_SES_ENABLED¶
Default: False
Set to True
(case insensitive) to enable sending of emails using AWS SES.
DJANGO_STATIC_ROOT¶
Default: ''
The location on the server’s filesystem to store static files at. This setting has no effect when DJANGO_S3_STORAGE
is True
.