config.cfg.template 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. # This file has been automatically generated on {{ timestamp }}.
  2. # Feel free to adjust it as needed.
  3. import os
  4. import datetime
  5. from flaskbb.configs.default import DefaultConfig
  6. # Flask Settings
  7. # ------------------------------
  8. # There is a whole bunch of more settings available here:
  9. # http://flask.pocoo.org/docs/0.11/config/#builtin-configuration-values
  10. DEBUG = {{ is_debug }}
  11. TESTING = False
  12. # Server Name - REQUIRED for Celery/Mailing
  13. # The name and port number of the server.
  14. # Required for subdomain support (e.g.: 'myapp.dev:5000') and
  15. # URL generation without a request context but with an application context
  16. # which we need in order to generate URLs (with the celery application)
  17. # Note that localhost does not support subdomains so setting this to
  18. # “localhost” does not help.
  19. # Example for the FlaskBB forums: SERVER_NAME = "forums.flaskbb.org"
  20. SERVER_NAME = "{{ server_name }}"
  21. # Prefer HTTPS over HTTP
  22. PREFERRED_URL_SCHEME = {% if use_https %}"https"{% else %}"http"{%endif%}
  23. # Don't send secure cookies over an unencrypted connection ()
  24. SESSION_COOKIE_SECURE = {% if use_https %}True{% else %}False{%endif%}
  25. # Don't make cookies available to JS (XSS) - browsers hide httpOnly cookies from JS
  26. SESSION_COOKIE_HTTPONLY = True
  27. # Database
  28. # ------------------------------
  29. # For MySQL:
  30. #SQLALCHEMY_DATABASE_URI="mysql+pymysql://flaskbb:password@localhost:3306/flaskbb"
  31. # For PostgresSQL:
  32. #SQLALCHEMY_DATABASE_URI = "postgresql://flaskbb@localhost:5432/flaskbb"
  33. # For SQLite:
  34. SQLALCHEMY_DATABASE_URI = "{{ database_uri }}"
  35. # This option will be removed as soon as Flask-SQLAlchemy removes it.
  36. # At the moment it is just used to suppress the super annoying warning
  37. SQLALCHEMY_TRACK_MODIFICATIONS = False
  38. # This will print all SQL statements
  39. SQLALCHEMY_ECHO = False
  40. # Security - IMPORTANT
  41. # ------------------------------
  42. # This is the secret key that is used for session signing.
  43. # You can generate a secure key with os.urandom(24)
  44. SECRET_KEY = "{{ secret_key }}"
  45. # You can generate the WTF_CSRF_SECRET_KEY the same way as you have
  46. # generated the SECRET_KEY. If no WTF_CSRF_SECRET_KEY is provided, it will
  47. # use the SECRET_KEY.
  48. WTF_CSRF_ENABLED = True
  49. WTF_CSRF_SECRET_KEY = "{{ csrf_secret_key }}"
  50. # Auth
  51. # ------------------------------
  52. LOGIN_VIEW = "auth.login"
  53. REAUTH_VIEW = "auth.reauth"
  54. LOGIN_MESSAGE_CATEGORY = "info"
  55. REFRESH_MESSAGE_CATEGORY = "info"
  56. # The name of the cookie to store the “remember me” information in.
  57. REMEMBER_COOKIE_NAME = "remember_token"
  58. # The amount of time before the cookie expires, as a datetime.timedelta object.
  59. # Default: 365 days (1 non-leap Gregorian year)
  60. REMEMBER_COOKIE_DURATION = datetime.timedelta(days=365)
  61. # If the “Remember Me” cookie should cross domains,
  62. # set the domain value here (i.e. .example.com would allow the cookie
  63. # to be used on all subdomains of example.com).
  64. REMEMBER_COOKIE_DOMAIN = None
  65. # Limits the “Remember Me” cookie to a certain path.
  66. REMEMBER_COOKIE_PATH = "/"
  67. # Restricts the “Remember Me” cookie’s scope to secure channels (typically HTTPS).
  68. REMEMBER_COOKIE_SECURE = {% if use_https %}True{% else %}False{%endif%}
  69. # Prevents the “Remember Me” cookie from being accessed by client-side scripts.
  70. REMEMBER_COOKIE_HTTPONLY = True
  71. # Full-Text-Search
  72. # ------------------------------
  73. # This will use the "whoosh_index" directory to store the search indexes
  74. WHOOSHEE_DIR = os.path.join(DefaultConfig.basedir, "whoosh_index", DefaultConfig.py_version)
  75. # How long should whooshee try to acquire write lock? (defaults to 2)
  76. WHOOSHEE_WRITER_TIMEOUT = 2
  77. # Minimum number of characters for the search (defaults to 3)
  78. WHOOSHEE_MIN_STRING_LEN = 3
  79. # Redis
  80. # ------------------------------
  81. # If redis is enabled, it can be used for:
  82. # - Sending non blocking emails via Celery (Task Queue)
  83. # - Caching
  84. # - Rate Limiting
  85. REDIS_ENABLED = {{ redis_enabled }}
  86. REDIS_URL = "{{ redis_uri }}"
  87. REDIS_DATABASE = 0
  88. # Celery
  89. # ------------------------------
  90. CELERY_CONFIG = {
  91. "broker_url": "{{ redis_uri }}",
  92. "result_backend": "{{ redis_uri }}",
  93. "broker_transport_options": {"max_retries": 1},
  94. }
  95. # Rate Limiting
  96. # -------------------------------
  97. # A full list with configuration values is available at the flask-limiter
  98. # docs, but you actually just need those settings below.
  99. # You can disabled the Rate Limiter here as well - it will overwrite
  100. # the setting from the admin panel!
  101. # RATELIMIT_ENABLED = True
  102. # You can choose from:
  103. # memory:// (default)
  104. # redis://host:port
  105. # memcached://host:port
  106. # Using the redis storage requires the installation of the redis package,
  107. # which will be installed if you enable REDIS_ENABLE while memcached
  108. # relies on the pymemcache package.
  109. RATELIMIT_STORAGE_URL = "{% if redis_enabled %}{{ redis_uri }}{% else %}memory://{% endif %}"
  110. # Caching
  111. # ------------------------------
  112. # For all available caching types, have a look at the Flask-Cache docs
  113. # https://pythonhosted.org/Flask-Caching/#configuring-flask-caching
  114. CACHE_TYPE = "{% if redis_enabled %}redis{% else %}simple{% endif %}"
  115. CACHE_DEFAULT_TIMEOUT = 60
  116. # Mail
  117. # ------------------------------
  118. # Google Mail Example
  119. # https://support.google.com/mail/answer/7126229?hl=en
  120. #MAIL_SERVER = "smtp.gmail.com"
  121. #MAIL_PORT = 587
  122. #MAIL_USE_TLS = True
  123. #MAIL_USE_SSL = True
  124. #MAIL_USERNAME = "your_username@gmail.com"
  125. #MAIL_PASSWORD = "your_password"
  126. #MAIL_DEFAULT_SENDER = ("Your Name", "your_username@gmail.com")
  127. # Local SMTP Server
  128. MAIL_SERVER = "{{ mail_server }}"
  129. MAIL_PORT = {{ mail_port }}
  130. MAIL_USE_SSL = {{ mail_use_ssl }}
  131. MAIL_USE_TLS = {{ mail_use_tls }}
  132. MAIL_USERNAME = "{{ mail_username }}"
  133. MAIL_PASSWORD = "{{ mail_password }}"
  134. MAIL_DEFAULT_SENDER = ("{{ mail_sender_name }}", "{{ mail_sender_address }}")
  135. # Where to logger should send the emails to
  136. ADMINS = ["{{ mail_admin_address }}"]
  137. # Logging Settings
  138. # ------------------------------
  139. # This config section will deal with the logging settings
  140. # for FlaskBB, adjust as needed.
  141. # Logging Config Path
  142. # see https://docs.python.org/library/logging.config.html#logging.config.fileConfig
  143. # for more details. Should either be None or a path to a file
  144. # If this is set to a path, consider setting USE_DEFAULT_LOGGING to False
  145. # otherwise there may be interactions between the log configuration file
  146. # and the default logging setting.
  147. #
  148. # If set to a file path, this should be an absolute file path
  149. {% if log_config_path %}
  150. LOG_CONF_FILE = "{{ log_config_path }}"
  151. {% else %}
  152. LOG_CONF_FILE = None
  153. {% endif %}
  154. # Path to store the INFO and ERROR logs
  155. # If None this defaults to flaskbb/logs
  156. #
  157. # If set to a file path, this should be an absolute path
  158. LOG_PATH = os.path.join(DefaultConfig.basedir, 'logs')
  159. # The default logging configuration that will be used when
  160. # USE_DEFAULT_LOGGING is set to True
  161. LOG_DEFAULT_CONF = {
  162. 'version': 1,
  163. 'disable_existing_loggers': False,
  164. 'formatters': {
  165. 'standard': {
  166. 'format': '%(asctime)s %(levelname)-7s %(name)-25s %(message)s'
  167. },
  168. 'advanced': {
  169. 'format': '%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]'
  170. }
  171. },
  172. 'handlers': {
  173. 'console': {
  174. 'level': 'NOTSET',
  175. 'formatter': 'standard',
  176. 'class': 'logging.StreamHandler',
  177. },
  178. 'flaskbb': {
  179. 'level': 'DEBUG',
  180. 'formatter': 'standard',
  181. 'class': 'logging.handlers.RotatingFileHandler',
  182. 'filename': os.path.join(LOG_PATH, 'flaskbb.log'),
  183. 'mode': 'a',
  184. 'maxBytes': 10485760, # 10MB
  185. 'backupCount': 5,
  186. },
  187. 'infolog': {
  188. 'level': 'INFO',
  189. 'formatter': 'standard',
  190. 'class': 'logging.handlers.RotatingFileHandler',
  191. 'filename': os.path.join(LOG_PATH, 'info.log'),
  192. 'mode': 'a',
  193. 'maxBytes': 10485760, # 10MB
  194. 'backupCount': 5,
  195. },
  196. 'errorlog': {
  197. 'level': 'ERROR',
  198. 'formatter': 'standard',
  199. 'class': 'logging.handlers.RotatingFileHandler',
  200. 'filename': os.path.join(LOG_PATH, 'error.log'),
  201. 'mode': 'a',
  202. 'maxBytes': 10485760, # 10MB
  203. 'backupCount': 5,
  204. }
  205. },
  206. 'loggers': {
  207. 'flask.app': {
  208. 'handlers': ['infolog', 'errorlog'],
  209. 'level': 'INFO',
  210. 'propagate': True
  211. },
  212. 'flaskbb': {
  213. 'handlers': ['console', 'flaskbb'],
  214. 'level': 'WARNING',
  215. 'propagate': True
  216. },
  217. }
  218. }
  219. # When set to True this will enable the default
  220. # FlaskBB logging configuration which uses the settings
  221. # below to determine logging
  222. USE_DEFAULT_LOGGING = True
  223. # If SEND_LOGS is set to True, the admins (see the mail configuration) will
  224. # recieve the error logs per email.
  225. SEND_LOGS = False
  226. # FlaskBB Settings
  227. # ------------------------------ #
  228. # URL Prefixes
  229. FORUM_URL_PREFIX = ""
  230. USER_URL_PREFIX = "/user"
  231. MESSAGE_URL_PREFIX = "/message"
  232. AUTH_URL_PREFIX = "/auth"
  233. ADMIN_URL_PREFIX = "/admin"
  234. # Remove dead plugins - useful if you want to migrate your instance
  235. # somewhere else and forgot to reinstall the plugins.
  236. # If set to `False` it will NOT remove plugins that are NOT installed on
  237. # the filesystem (virtualenv, site-packages).
  238. REMOVE_DEAD_PLUGINS = False
  239. # determines the warning level for FlaskBB Deprecations
  240. DEPRECATION_LEVEL = "{{ deprecation_level }}"