config.cfg.template 8.9 KB

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