Skip to content

Settings

The settings of Cousins Matter can be managed using a .env file in the main directory of the application.

If you have used the manage_cousins_matter.py script to install Cousins Matter as described in Installation, an example .env file has been downloaded for you automatically and the SECRET_KEY and the POSTGRES_PASSWORD have been generated automatically (don’t overwrite them!).

If you are working from source, copy the env.example file to .env

In both cases, you now need to edit .env to set the properties according to your context as described below.

There are many settings available to customize the technical part of your site…

Also, don’t forget to check out Customization to customize the look and feel of your site.

WARNING: If the container is already running, the update of the settings in .env won’t be taken into account until you restart it. To do that, just run the following command (in the site directory):

docker compose restart
  • SECRET_KEY: A secret key that protects your site. Must be outrageously complex and kept secret! The easiest way to generate it is to run python manage_cousins_matter.py rotate-secrets. This script will also update the PREVIOUS_SECRET_KEYS in the .env file. This variable is used to decode the tokens that have been sent to members with the previous secret key.

    (Again, if you used manage_cousins_matter.py to install Cousins Matter, this has already been generated for you, don’t overwrite it)

  • MAX_REGISTRATION_AGE: Maximum validity in seconds for invitation tokens, default is 2 days (2243600)

  • SECURE_HSTS_SECONDS: Enables HTTP Strict Transport Security (HSTS) in production: the number of seconds browsers remember to access the site over HTTPS only. Default is 0 (disabled). Only enable it once the site is permanently served over HTTPS.

Before running docker compose up -d the first time, provide the information to create the superuser (ie the admin account).

  • ADMIN: the superuser account name
  • ADMIN_PASSWORD: the superuser password
  • ADMIN_EMAIL: the superuser email
  • ADMIN_FIRSTNAME: the superuser first name
  • ADMIN_LASTNAME: the superuser last name

ALL THESE VARIABLES ARE MANDATORY TO CREATE THE SUPERUSER ACCOUNT AND HAVE NO DEFAULT VALUES

You can manage the features that will be offered to members in the .env file.

To do so, modify the FEATURES_FLAGS variable based on the contents of the env.example file and set the value of each feature to be ignored to false.

The default value of FEATURES_FLAGS is:

FEATURES_FLAGS="show_birthdays_in_homepage=True;show_galleries=True;show_forums=True;show_public_chats=True;show_private_chats=True;show_classified_ads=True;show_polls=True;show_event_planners=True;show_pages=True;show_treasures=True;show_site_stats=True;show_export_members=True;show_change_language=True;show_genealogy=True"

Available feature flags:

  • show_birthdays_in_homepage: Display upcoming birthdays on the homepage for authenticated members
  • show_galleries: Enable photo and video galleries feature
  • show_forums: Enable forum discussions
  • show_public_chats: Enable public chat rooms
  • show_private_chats: Enable private chat rooms
  • show_classified_ads: Enable classified ads feature
  • show_polls: Enable polls feature
  • show_event_planners: Enable event planning surveys (date selection polls)
  • show_pages: Enable CMS pages feature
  • show_treasures: Enable troves (family treasures) feature
  • show_site_stats: Show site statistics page
  • show_export_members: Allow member directory export to PDF
  • show_change_language: Allow language switching in the interface
  • show_genealogy: Enable genealogy features (family trees, GEDCOM import/export)

WARNINGS:

  1. The variable INCLUDE_BIRTHDAYS_IN_HOMEPAGE has been replaced by the feature flag show_birthdays_in_homepage, as shown above.
  2. The FEATURES_FLAGS must stay on one line in the .env file. All flags are separated by semicolons. If you set this variable in your .env file and a flag is not present in the list, it is considered false.
  • SITE_NAME: The name of the site, default is ‘Cousins Matter!’.
  • SITE_DOMAIN: The domain of the site, e.g. myfamily.com, no default.
  • SITE_FOOTER: The optional footer of the site, e.g. “The Simpsons Family Social Network”.
  • SITE_LOGO: The optional relative URL of your site logo (in the top left corner). Must have a 4:1 ratio. MUST BE STORED IN your site’s media/public folder, so the URL must start with ‘/media/public’ (e.g. SITE_LOGO=‘/media/public/my-own-logo.jpg’)
  • SITE_COPYRIGHT: Your site copyright, e.g. ‘Copyright © 2024 Cousins Matter’.
  • DARK_MODE: Enable dark mode theme. Default is False.
  • ALLOW_MEMBERS_TO_CREATE_MEMBERS: Default is True. To prevent members from creating and managing other members, set to False and only admins will be able to do this.
  • ALLOW_MEMBERS_TO_INVITE_MEMBERS: Default is True. To prevent members from inviting other members to join the site, set to False and only admins will be able to do this.
  • BIRTHDAY_DAYS: Number of days in the future to display birthdays, default is 50
  • INCLUDE_BIRTHDAYS_IN_HOMEPAGE: OBSOLETE - Use show_birthdays_in_homepage in FEATURES_FLAGS instead
  • PDF_SIZE: PDF page size for printed directory. ‘A4’ or ‘letter’ size. Default is A4.
  • MAX_CSV_FILE_SIZE(*): Maximum size of CSV member import file, default is 2MB.
  • LOGIN_HISTORY_GEOLOCATION_PLACEHOLDER_IP: Enter here the external IP of your server. It is used for the login trace when the login comes from the internal network. Default is “8.8.8.8”.
  • LOGIN_HISTORY_PURGE_DAYS: Number of days to keep login history (visible to administrators in Django admin), default is 365.
  • DEFAULT_GALLERY_PAGE_SIZE: Number of photos per gallery page (changeable on screen), default is 25
  • MAX_PHOTO_FILE_SIZE(*): Maximum size of each photo, default is 5MB
  • MAX_VIDEO_FILE_SIZE(*): Maximum size of each video, default is 20MB
  • MAX_GALLERY_BULK_UPLOAD_SIZE(*): Maximum size of galleries zip bulk upload file, default is 20MB
  • SLIDESHOW_DELAY: Delay in seconds between each photo in a slideshow, default is 5
  • MESSAGE_MAX_SIZE(*): Maximum size of a message in the Forum or in the chats (note that it may contain a photo), default is 2.5MB.
  • MESSAGE_COMMENTS_MAX_SIZE(*): Maximum size of a comment associated with a message in the Forum or in the chats, default is 1000
  • CONTACT_MAX_SIZE(*): Maximum size of a contact message, default is 1MB
  • PAGE_MAX_SIZE(*): Maximum size of a flat page, default is 10MB
  • POLL_MAX_SIZE(*): Maximum size of a poll, default is 1MB
  • CLASSIFIED_AD_MAX_SIZE(*): Maximum size of a classified ad, default is 1MB
  • TROVE_FILE_MAX_SIZE(*): Maximum size of a trove file, default is 20MB
  • TROVE_PICTURE_FILE_MAX_SIZE(*): Maximum size of a trove picture, default is 5MB
  • TROVE_THUMBNAIL_SIZE(*): Maximum size of a trove thumbnail in pixels, default is 100
  • DEFAULT_TROVE_PAGE_SIZE(*): Default number of troves per page, default is 10
  • MAX_PHOTO_PER_AD: Maximum number of photos per classified ad, default is 10
  • FAMILY_CHART_GENERATIONS: Number of generations to show up and down the center person in the family chart, default is 4
  • FAMILY_CHART_ROOT_PERSON_ID: Default root person ID to show in the family chart if none is specified, default is if the id of the first person in the database
  • GEDCOM_FILE: GEDCOM file to use for exporting genealogy, default is ‘genealogy.ged’
  • OAUTH_PROVIDERS: Comma-separated list of OAuth providers to enable. Available providers: google, facebook, apple, github, pocketid, or any openid_connect provider. Default is empty (no OAuth enabled).
  • SOCIALACCOUNT_AUTO_SIGNUP: Whether to require confirmation when a user logs in with an OAuth provider. Default is False (confirmation required).

For each provider, you need to set:

  • <PROVIDER>_OAUTH_CLIENT_ID: OAuth client ID for the provider
  • <PROVIDER>_OAUTH_CLIENT_SECRET: OAuth client secret for the provider

For OpenID Connect providers (including PocketID):

  • <PROVIDER>_SERVER_URL: OpenID Connect server URL

Example configuration:

OAUTH_PROVIDERS=google,github,pocketid
GOOGLE_OAUTH_CLIENT_ID=your_google_client_id
GOOGLE_OAUTH_CLIENT_SECRET=your_google_client_secret
GITHUB_OAUTH_CLIENT_ID=your_github_client_id
GITHUB_OAUTH_CLIENT_SECRET=your_github_client_secret
POCKETID_SERVER_URL=https://pocketid.yourdomain.com
POCKETID_OAUTH_CLIENT_ID=your_pocketid_client_id
POCKETID_OAUTH_CLIENT_SECRET=your_pocketid_client_secret

See OAuth Authentication for detailed configuration instructions for each provider.

  • DJANGO_LOG_LEVEL: Log level for django and internal libraries, default is INFO
  • CM_LOG_LEVEL: Log level for cousins matter, default is INFO
  • ALLOWED_HOSTS: Comma separated list of hosts. Default is ‘127.0.0.1,localhost,<SITE_DOMAIN>’. You MUST set ALLOWED_HOSTS for production and it MUST contain your full site url and sometimes, depending on your host network settings, the general site IP e.g.:

    ALLOWED_HOSTS=127.0.0.1,localhost,my.cousins-matter.com,165.157.221.171

  • CORS_ALLOWED_ORIGINS: Comma-separated list of hosts. Default is empty.

    WARNING! If your log shows errors such as

    Forbidden (Origin checking failed - https://my.cousins-matter.com/ does not match any trusted origins.): /members/login/

    you should set CORS_ALLOWED_ORIGINS=<your full domain> (e.g. https://my.cousins-matter.com) in the .env file,

    Don’t use the Python syntax shown in the error!.

    If you have multiple hosts, list them separated by commas, e.g.

    CORS_ALLOWED_ORIGINS=https://my.cousins-matter.com,https://my.cousins-matter.org

    For information, CSRF_TRUSTED_ORIGINS is set to the value of CORS_ALLOWED_ORIGINS

  • LANGUAGE_CODE: E.g. ‘fr’ or ‘fr-CA’. Default is ‘en-US’.
  • TIME_ZONE: Time zone, default is ‘Europe/Paris’.
  • EMAIL_HOST: SMTP host name, no default
  • EMAIL_PORT: Port to connect to on SMTP server
  • EMAIL_USE_TLS: SMTP server uses STARTLS if true, default is true
  • EMAIL_USE_SSL: SMTP server uses SSL if true, default is false
  • EMAIL_HOST_USER: User name to connect to the SMTP server.
  • EMAIL_HOST_PASSWORD: Password for connecting to the SMTP server
  • DEFAULT_FROM_EMAIL: Default email address to use when sending email
  • POSTGRES_USER: The postgres user, default is ‘cousinsmatter’

  • POSTGRES_PASSWORD: The postgres password. It is generated automatically if you use manage_cousins_matter.py to install or migrate Cousins Matter. WARNING! Use only -_./* as special characters if you want to change it. Absolutely avoid : and @ !

  • POSTGRES_DB: The postgres database, default is ‘cousinsmatter’

  • POSTGRES_HOST: The postgres host, default is ‘postgres’

  • REDIS_HOST: The redis host, default is ‘redis’

  • MULTI_TENANT_ENABLED: Serve several families (tenants) from a single deployment, with isolated data. Default is False. When enabled, the /tenants/ URLs (family signup and management) are exposed. See Multi-tenancy.
  • DEFAULT_TENANT_SLUG: Slug of the tenant assigned to members when none can be resolved (legacy or bootstrap data, management commands). Default is default.
  • SYSTEM_TENANT_SLUG: Slug of the tenant hosting platform (cross-tenant) superusers. It can never be deleted. Default is system.
  • TENANT_EXPORT_TTL_DAYS: Number of days a family data export ZIP (spreadsheet and media) stays downloadable. Default is 7.
  • POSTGRES_RUNTIME_USER / POSTGRES_RUNTIME_PASSWORD: Dedicated non-owner PostgreSQL role used by the web and qcluster processes. When both are set and MULTI_TENANT_ENABLED is on, row-level security policies apply to the application. Leave them empty to connect as POSTGRES_USER (row-level security then has no effect). Migrations always run as POSTGRES_USER.

The database is dumped daily on the host by scripts/backup.sh (also make backup), which runs pg_dump inside the PostgreSQL container. Dumps are written to ./backup, verified with pg_restore, optionally uploaded with the aws CLI, and pruned after BACKUP_KEEP_DAYS. These variables belong to the script’s environment (host cron or shell), not to the Django application.

  • BACKUP_KEEP_DAYS: Number of days local dumps are kept. Default is 14.
  • BACKUP_S3_BUCKET: S3-compatible bucket (Cloudflare R2, MinIO, …) receiving the dumps. Empty (the default) keeps dumps local only.
  • BACKUP_S3_ENDPOINT_URL: Endpoint of the S3-compatible service, e.g. https://<account>.r2.cloudflarestorage.com.
  • BACKUP_S3_PREFIX: Object prefix of the dumps in the bucket. Default is db-backups.
  • AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY: Credentials read by the aws CLI for the upload.
  • SENTRY_DSN: Sentry DSN enabling error tracking in production. Empty (the default) disables it. No personal data is sent.
  • SENTRY_ENVIRONMENT: Environment name reported to Sentry. Default is production.
  • SENTRY_TRACES_SAMPLE_RATE: Share of requests traced by Sentry, between 0 and 1. Default is 0.0 (tracing disabled).

(*) WARNING: If you want to change any of the variables controling the size of what can be uploaded and you are using the nginx reverse proxy, please check that the value of client_max_body_size in config/nginx/nginx.conf so that it remains higher than the size variables you change above. Otherwise you will receive a 413 error from Nginx. The default value provided is high (20MB) but you might need to increase it to support larger videos.