This repository has been archived by the owner on Oct 15, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
account_config_template.py.j2
116 lines (87 loc) · 3.54 KB
/
account_config_template.py.j2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# -*- coding: utf-8 -*-
from os import urandom
# Statement for enabling the development environment
DEBUG = True
# Enable more detailed logging
SUPER_DEBUG = True
# Application URL prefix
## Only leading slash
{% if URL_PREFIX is defined %}
URL_PREFIX = {{ URL_PREFIX }}
{% else %}
URL_PREFIX = ''
{% endif %}
# Logger
LOG_FORMATTER = '%(asctime)s - %(name)s in function %(funcName)s at line: %(lineno)s - %(levelname)s - %(message)s'
LOG_PATH = './logs/'
LOG_FILE = LOG_PATH + 'account.log'
LOG_TO_FILE = False
# Define the application directory
import os
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
# Define the database
# Flask-MySQLdb - http://flask-mysqldb.readthedocs.org/en/latest/
# Name of host to connect to. Default: use the local host via a UNIX socket (where applicable)
{% if MYSQL_HOST is defined %}
MYSQL_HOST = {{ MYSQL_HOST }}
{% else %}
MYSQL_HOST = 'localhost'
{% endif %}
# User to authenticate as. Default: current effective user.
{% if MYSQL_USER is defined %}
MYSQL_USER = {{ MYSQL_USER }}
{% else %}
MYSQL_USER = 'mydataaccount'
{% endif %}
# Password to authenticate with. Default: no password.
{% if MYSQL_PASSWORD is defined %}
MYSQL_PASSWORD = {{ MYSQL_PASSWORD }}
{% else %}
MYSQL_PASSWORD = 'wr8gabrA'
{% endif %}
# Database to use. Default: no default database.
{% if MYSQL_DB is defined %}
MYSQL_DB = {{ MYSQL_DB }}
{% else %}
MYSQL_DB = 'MyDataAccount'
{% endif %}
# TCP port of MySQL server. Default: 3306.
{% if MYSQL_PORT is defined %}
MYSQL_PORT = {{ MYSQL_PORT }}
{% else %}
MYSQL_PORT = 3306
{% endif %}
# Server for url_for -function with external=true parameters
#{% if SERVER_NAME is defined %}
#SERVER_NAME = {{ SERVER_NAME }}
#{% else %}
#SERVER_NAME = ''
#{% endif %}
#MYSQL_UNIX_SOCKET = '' # Location of UNIX socket. Default: use default location or TCP for remote hosts.
#MYSQL_CONNECT_TIMEOUT = '10' # Abort if connect is not completed within given number of seconds. Default: 10
#MYSQL_READ_DEFAULT_FILE = '' # MySQL configuration file to read, see the MySQL documentation for mysql_options().
#MYSQL_USE_UNICODE = '' # If True, CHAR and VARCHAR and TEXT columns are returned as Unicode strings, using the configured character set.
MYSQL_CHARSET = 'utf8' # If present, the connection character set will be changed to this character set, if they are not equal. Default: utf-8
MYSQL_SQL_MODE = 'TRADITIONAL' # If present, the session SQL mode will be set to the given string.
#MYSQL_CURSORCLASS = '' # If present, the cursor class will be set to the given string.
# Application threads. A common general assumption is
# using 2 per available processor cores - to handle
# incoming requests using one and performing background
# operations using the other.
THREADS_PER_PAGE = 1
# Enable protection against *Cross-site Request Forgery (CSRF)*
CSRF_ENABLED = True
# Use a secure, unique and absolutely secret key for
# signing the data.
CSRF_SESSION_KEY = str(urandom(24))
# Secret key for signing cookies
SECRET_KEY = str(urandom(24))
# http://flask-restful-cn.readthedocs.org/en/0.3.5/reqparse.html#error-handling
BUNDLE_ERRORS = True
# Flask-Login
LOGIN_VIEW = "signin" # https://flask-login.readthedocs.org/en/latest/#customizing-the-login-process
LOGIN_MESSAGE = "Authentication required" # https://flask-login.readthedocs.org/en/latest/#customizing-the-login-process
SESSION_PROTECTION = "strong" # https://flask-login.readthedocs.org/en/latest/#session-protection
# Optional cookie settings: https://flask-login.readthedocs.org/en/latest/#cookie-settings
# Default locations
AVATAR_URL = 'img/avatars/mydata-avatar.png'