PCv5/config.py

38 lines
1.2 KiB
Python
Raw Normal View History

2018-02-23 23:34:06 +01:00
import os
import datetime
from local_config import LocalConfig
class Config(LocalConfig):
SECRET_KEY = os.environ.get('SECRET_KEY') or LocalConfig.SECRET_KEY
2018-02-23 23:34:06 +01:00
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \
'postgresql+psycopg2://' + os.environ.get('USER') + ':@/' \
+ LocalConfig.DB_NAME
2018-02-23 23:34:06 +01:00
SQLALCHEMY_TRACK_MODIFICATIONS = False
UPLOAD_FOLDER = './app/static/avatars'
2019-02-03 15:40:37 +01:00
class V5Config(object):
# Length allocated to privilege names (slugs)
PRIVS_MAXLEN = 64
# Forbidden user names
FORBIDDEN_USERNAMES = ["admin", "root", "webmaster", "contact"]
2019-02-05 11:30:39 +01:00
# Unauthorized message (@priv_required)
UNAUTHORIZED_MSG = "Vous n'avez pas l'autorisation d'effectuer cette action!"
# Minimum and maximum user name length
USER_NAME_MINLEN = 3
USER_NAME_MAXLEN = 32
# Minimum password length for new users and new passwords
PASSWORD_MINLEN = 10
2019-08-20 17:34:00 +02:00
# Maximum thread name length
THREAD_NAME_MAXLEN = 32
# Remember-me cookie duration time
REMEMBER_COOKIE_DURATION = datetime.timedelta(days=7)
# XP points for content posting (and deletion)
XP_POINTS = {
'topic': 2,
'program': 5,
'tutorial': 5,
'comment': 1,
'contest': 10,
}