config.example 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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: Wednesday 2019-05-08 16:28:02 (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 = {'db': 1, 'password': 'your password', 'decode_responses': True}
  43. # some middleware
  44. MIDDLEWARE = ['forums.common.middleware.GlobalMiddleware',
  45. 'forums.common.middleware.OnlineMiddleware']
  46. # Mail such as qq
  47. MAIL_SERVER = 'smtp.qq.com'
  48. MAIL_PORT = 25
  49. MAIL_USE_TLS = True
  50. MAIL_USE_SSL = False
  51. MAIL_USERNAME = "your email"
  52. MAIL_PASSWORD = "your password"
  53. MAIL_DEFAULT_SENDER = 'your email'
  54. # MAIL_SUPPRESS_SEND = True
  55. SERVER_NAME = 'localhost:8000'
  56. SUBDOMAIN = {'forums': True, 'docs': True}
  57. # logging setting
  58. LOGGING = {
  59. 'info': 'logs/info.log',
  60. 'error': 'logs/error.log',
  61. 'send_mail': False,
  62. 'toaddrs': [],
  63. 'subject': 'Your Application Failed',
  64. 'formatter': '''
  65. Message type: %(levelname)s
  66. Location: %(pathname)s:%(lineno)d
  67. Module: %(module)s
  68. Function: %(funcName)s
  69. Time: %(asctime)s
  70. Message:
  71. %(message)s
  72. '''
  73. }
  74. # Sql
  75. SQLALCHEMY_DATABASE_URI = 'postgresql://postgres:password@localhost/your_db'
  76. # SQLALCHEMY_DATABASE_URI = 'sqlite:///test.db'
  77. MSEARCH_INDEX_NAME = 'msearch'
  78. MSEARCH_BACKEND = 'whoosh'
  79. # SQLALCHEMY_ECHO = True
  80. # SQLALCHEMY_DATABASE_URI = 'sqlite:///test.db'
  81. # SQLALCHEMY_DATABASE_URI = 'mysql://username:password@server/db'
  82. BABEL_DEFAULT_LOCALE = 'en'
  83. BABEL_DEFAULT_TIMEZONE = 'UTC'
  84. BABEL_TRANSLATION_DIRECTORIES = path.join(PATH, 'translations')