production.py.example 6.2 KB

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