ddns/settings.example.py

39 lines
1.3 KiB
Python

# -*- coding: utf-8 -*-
from wtforms.validators import ValidationError
class ConfigClass(object):
""" Configuration class """
SECRET_KEY = 'THIS IS AN INSECURE SECRET' # Change this for production!
SQLALCHEMY_DATABASE_URI = 'sqlite:///minimal_app.sqlite' # Use Sqlite file db
CSRF_ENABLED = True
USER_ENABLE_EMAIL = True
USER_ENABLE_CHANGE_USERNAME = True
USER_ENABLE_CHANGE_PASSWORD = True
USER_ENABLE_FORGOT_PASSWORD = True
USER_ENABLE_REGISTRATION = True # Turn to False to disable registration.
""" Configure Flask-Mail """
MAIL_SERVER = 'your.mailserver.here'
MAIL_PORT = 587
MAIL_USE_SSL = True
MAIL_USE_TLS = True # Use this for STARTTLS!
MAIL_USERNAME = ''
MAIL_PASSWORD = ''
MAIL_DEFAULT_SENDER = '"Example Sender" <cool@service.example>'
""" Default Admin User """
DDNS_ADMIN_USERNAME = 'admin'
DDNS_ADMIN_PASSWORD = 'SuperSecretAdminPassword'
DDNS_ADMIN_EMAIL = 'admin@service.example'
def username_validator(form, field):
""" Since usernames will be used for subdomains, take your time here. """
username = field.data
if len(username) < 4:
raise ValidationError(_('Username must be at least 4 characters long'))
if not username.isalnum():
raise ValidationError(_('Username may only contain letters and numbers'))