config.example 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #!/usr/bin/env python
  2. # -*- coding=UTF-8 -*-
  3. # **************************************************************************
  4. # Copyright © 2016-2019 jianglin
  5. # File Name: config.example
  6. # Author: jianglin
  7. # Email: mail@honmaple.com
  8. # Created: 2016-05-20 12:31:46 (CST)
  9. # Last Update: Monday 2022-12-12 16:40:46 (CST)
  10. # By: jianglin
  11. # Description:
  12. # **************************************************************************
  13. from datetime import timedelta
  14. from os import path
  15. PATH = path.abspath(path.dirname(__file__))
  16. DEBUG = True
  17. SECRET_KEY = 'secret key'
  18. SECURITY_PASSWORD_SALT = 'you will never guess'
  19. SECRET_KEY_SALT = 'you will never guess'
  20. # avatar upload directory
  21. AVATAR_FOLDER = path.join(PATH, 'avatars')
  22. # avatar generate range
  23. AVATAR_RANGE = [122, 512]
  24. # for development use localhost:5000
  25. # for production use xxx.com
  26. # SERVER_NAME = 'localhost:5000'
  27. # remember me to save cookies
  28. PERMANENT_SESSION_LIFETIME = timedelta(days=3)
  29. REMEMBER_COOKIE_DURATION = timedelta(days=3)
  30. ONLINE_LAST_MINUTES = 5
  31. # You want show how many topics per page
  32. PER_PAGE = 12
  33. # Use cache
  34. CACHE_TYPE = 'null'
  35. CACHE_DEFAULT_TIMEOUT = 60
  36. CACHE_KEY_PREFIX = 'cache:'
  37. CACHE_REDIS_HOST = '127.0.0.1'
  38. CACHE_REDIS_PORT = '6379'
  39. CACHE_REDIS_PASSWORD = 'your password'
  40. CACHE_REDIS_DB = 2
  41. # Redis setting
  42. REDIS = {
  43. 'host': 'redis',
  44. 'db': 1,
  45. 'password': 'your password',
  46. 'decode_responses': True
  47. }
  48. # some middleware
  49. MIDDLEWARE = [
  50. 'forums.common.middleware.GlobalMiddleware',
  51. 'forums.common.middleware.OnlineMiddleware'
  52. ]
  53. # Mail such as qq
  54. MAIL_SERVER = 'smtp.qq.com'
  55. MAIL_PORT = 25
  56. MAIL_USE_TLS = True
  57. MAIL_USE_SSL = False
  58. MAIL_USERNAME = "your email"
  59. MAIL_PASSWORD = "your password"
  60. MAIL_DEFAULT_SENDER = 'your email'
  61. # MAIL_SUPPRESS_SEND = True
  62. SERVER_NAME = 'localhost:8000'
  63. SUBDOMAIN = {'forums': True, 'docs': True}
  64. # logging setting
  65. LOGGING = {
  66. 'info': 'logs/info.log',
  67. 'error': 'logs/error.log',
  68. 'send_mail': False,
  69. 'toaddrs': [],
  70. 'subject': 'Your Application Failed',
  71. 'formatter': '''
  72. Message type: %(levelname)s
  73. Location: %(pathname)s:%(lineno)d
  74. Module: %(module)s
  75. Function: %(funcName)s
  76. Time: %(asctime)s
  77. Message:
  78. %(message)s
  79. '''
  80. }
  81. # Sql
  82. SQLALCHEMY_DATABASE_URI = 'postgresql://postgres:password@localhost/your_db'
  83. # SQLALCHEMY_DATABASE_URI = 'sqlite:///test.db'
  84. MSEARCH_INDEX_NAME = 'msearch'
  85. MSEARCH_BACKEND = 'whoosh'
  86. # SQLALCHEMY_ECHO = True
  87. # SQLALCHEMY_DATABASE_URI = 'sqlite:///test.db'
  88. # SQLALCHEMY_DATABASE_URI = 'mysql://username:password@server/db'
  89. BABEL_DEFAULT_LOCALE = 'en'
  90. BABEL_DEFAULT_TIMEZONE = 'UTC'
  91. BABEL_TRANSLATION_DIRECTORIES = path.join(PATH, 'translations')