default.py 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. # -*- coding: utf-8 -*-
  2. """
  3. flaskbb.configs.default
  4. ~~~~~~~~~~~~~~~~~~~~~~~
  5. This is the default configuration for FlaskBB that every site should have.
  6. You can override these configuration variables in another class.
  7. :copyright: (c) 2014 by the FlaskBB Team.
  8. :license: BSD, see LICENSE for more details.
  9. """
  10. import os
  11. import sys
  12. import datetime
  13. class DefaultConfig(object):
  14. # Get the app root path
  15. # <_basedir>
  16. # ../../ --> flaskbb/flaskbb/configs/base.py
  17. _basedir = os.path.join(os.path.abspath(os.path.dirname(os.path.dirname(
  18. os.path.dirname(__file__)))))
  19. # Python version
  20. _version_str = '{0.major}{0.minor}'.format(sys.version_info)
  21. # Flask Settings
  22. # ------------------------------
  23. # There is a whole bunch of more settings available here:
  24. # http://flask.pocoo.org/docs/0.11/config/#builtin-configuration-values
  25. DEBUG = False
  26. TESTING = False
  27. # Server Name
  28. # The name and port number of the server.
  29. # Required for subdomain support (e.g.: 'myapp.dev:5000') and
  30. # URL generation without a request context but with an application context
  31. # which we need in order to generate URLs (with the celery application)
  32. # Note that localhost does not support subdomains so setting this to
  33. # “localhost” does not help.
  34. # Example for the FlaskBB forums: SERVER_NAME = "forums.flaskbb.org"
  35. #SERVER_NAME =
  36. # The preferred url scheme. In a productive environment it is highly
  37. # recommended to use 'https'.
  38. # This only affects the url generation with 'url_for'.
  39. PREFERRED_URL_SCHEME = "http"
  40. # If SEND_LOGS is set to True, the admins (see the mail configuration) will
  41. # recieve the error logs per email.
  42. SEND_LOGS = False
  43. # The filename for the info and error logs. The logfiles are stored at
  44. # flaskbb/logs
  45. INFO_LOG = "info.log"
  46. ERROR_LOG = "error.log"
  47. # Database
  48. # ------------------------------
  49. # For PostgresSQL:
  50. #SQLALCHEMY_DATABASE_URI = "postgresql://flaskbb@localhost:5432/flaskbb"
  51. # For SQLite:
  52. SQLALCHEMY_DATABASE_URI = 'sqlite:///' + _basedir + '/' + \
  53. 'flaskbb.sqlite'
  54. # This option will be removed as soon as Flask-SQLAlchemy removes it.
  55. # At the moment it is just used to suppress the super annoying warning
  56. SQLALCHEMY_TRACK_MODIFICATIONS = False
  57. # This will print all SQL statements
  58. SQLALCHEMY_ECHO = False
  59. # Security
  60. # ------------------------------
  61. # This is the secret key that is used for session signing.
  62. # You can generate a secure key with os.urandom(24)
  63. SECRET_KEY = 'secret key'
  64. # You can generate the WTF_CSRF_SECRET_KEY the same way as you have
  65. # generated the SECRET_KEY. If no WTF_CSRF_SECRET_KEY is provided, it will
  66. # use the SECRET_KEY.
  67. WTF_CSRF_ENABLED = True
  68. WTF_CSRF_SECRET_KEY = "reallyhardtoguess"
  69. # Full-Text-Search
  70. # ------------------------------
  71. # This will use the "whoosh_index" directory to store the search indexes
  72. WHOOSHEE_DIR = os.path.join(_basedir, "whoosh_index", _version_str)
  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. # Auth
  78. # ------------------------------
  79. LOGIN_VIEW = "auth.login"
  80. REAUTH_VIEW = "auth.reauth"
  81. LOGIN_MESSAGE_CATEGORY = "info"
  82. REFRESH_MESSAGE_CATEGORY = "info"
  83. # The name of the cookie to store the “remember me” information in.
  84. REMEMBER_COOKIE_NAME = "remember_token"
  85. # The amount of time before the cookie expires, as a datetime.timedelta object.
  86. REMEMBER_COOKIE_DURATION = datetime.timedelta(days=365)
  87. # If the “Remember Me” cookie should cross domains,
  88. # set the domain value here (i.e. .example.com would allow the cookie
  89. # to be used on all subdomains of example.com).
  90. REMEMBER_COOKIE_DOMAIN = None
  91. # Limits the “Remember Me” cookie to a certain path.
  92. REMEMBER_COOKIE_PATH = "/"
  93. # Restricts the “Remember Me” cookie’s scope to secure channels (typically HTTPS).
  94. REMEMBER_COOKIE_SECURE = None
  95. # Prevents the “Remember Me” cookie from being accessed by client-side scripts.
  96. REMEMBER_COOKIE_HTTPONLY = False
  97. # Rate Limiting via Flask-Limiter
  98. # -------------------------------
  99. # A full list with configuration values is available at the flask-limiter
  100. # docs, but you actually just need those settings below.
  101. # You can disabled the Rate Limiter here as well - it will overwrite
  102. # the setting from the admin panel!
  103. # RATELIMIT_ENABLED = True
  104. # You can choose from:
  105. # memory:// (default)
  106. # redis://host:port
  107. # memcached://host:port
  108. # Using the redis storage requires the installation of the redis package,
  109. # which will be installed if you enable REDIS_ENABLE while memcached
  110. # relies on the pymemcache package.
  111. #RATELIMIT_STORAGE_URL = "redis://localhost:6379"
  112. # Caching
  113. # ------------------------------
  114. # For all available caching types, have a look at the Flask-Cache docs
  115. # https://pythonhosted.org/Flask-Caching/#configuring-flask-caching
  116. CACHE_TYPE = "simple"
  117. # For redis:
  118. #CACHE_TYPE = "redis"
  119. CACHE_DEFAULT_TIMEOUT = 60
  120. # Mail
  121. # ------------------------------
  122. # Google Mail Example
  123. #MAIL_SERVER = "smtp.gmail.com"
  124. #MAIL_PORT = 465
  125. #MAIL_USE_SSL = True
  126. #MAIL_USERNAME = "your_username@gmail.com"
  127. #MAIL_PASSWORD = "your_password"
  128. #MAIL_DEFAULT_SENDER = ("Your Name", "your_username@gmail.com")
  129. # Local SMTP Server
  130. MAIL_SERVER = "localhost"
  131. MAIL_PORT = 25
  132. MAIL_USE_SSL = False
  133. MAIL_USE_TLS = False
  134. MAIL_USERNAME = "noreply@example.org"
  135. MAIL_PASSWORD = ""
  136. MAIL_DEFAULT_SENDER = ("Default Sender", "noreply@example.org")
  137. # Where to logger should send the emails to
  138. ADMINS = ["admin@example.org"]
  139. # Redis
  140. # ------------------------------ #
  141. # If redis is enabled, it can be used for:
  142. # - Sending non blocking emails via Celery (Task Queue)
  143. # - Caching
  144. # - Rate Limiting
  145. REDIS_ENABLED = False
  146. REDIS_URL = "redis://localhost:6379" # or with a password: "redis://:password@localhost:6379"
  147. REDIS_DATABASE = 0
  148. # Celery
  149. CELERY_BROKER_URL = 'redis://localhost:6379'
  150. CELERY_RESULT_BACKEND = 'redis://localhost:6379'
  151. # FlaskBB Settings
  152. # ------------------------------ #
  153. # URL Prefixes
  154. FORUM_URL_PREFIX = ""
  155. USER_URL_PREFIX = "/user"
  156. MESSAGE_URL_PREFIX = "/message"
  157. AUTH_URL_PREFIX = "/auth"
  158. ADMIN_URL_PREFIX = "/admin"
  159. # Plugin Folder
  160. PLUGINS_FOLDER = os.path.join(_basedir, "flaskbb", "plugins")