config.example 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #!/usr/bin/env python
  2. # -*- coding=UTF-8 -*-
  3. # **************************************************************************
  4. # Copyright © 2016 jianglin
  5. # File Name: config.py
  6. # Author: jianglin
  7. # Email: xiyang0807@gmail.com
  8. # Created: 2016-05-20 12:31:46 (CST)
  9. # Last Update:星期日 2017-4-2 15:39:4 (CST)
  10. # By: jianglin
  11. # Description:
  12. # **************************************************************************
  13. from datetime import timedelta
  14. from os import path, pardir
  15. DEBUG = True
  16. SECRET_KEY = 'secret key'
  17. SECURITY_PASSWORD_SALT = 'you will never guess'
  18. SECRET_KEY_SALT = 'you will never guess'
  19. # avatar upload directory
  20. AVATAR_FOLDER = path.join(path.abspath(path.dirname(__file__)), 'avatar')
  21. # avatar generate range
  22. AVATAR_RANGE = [122, 512]
  23. # for development use localhost:5000
  24. # for production use xxx.com
  25. # SERVER_NAME = 'localhost:5000'
  26. # remember me to save cookies
  27. PERMANENT_SESSION_LIFETIME = timedelta(days=3)
  28. REMEMBER_COOKIE_DURATION = timedelta(days=3)
  29. ONLINE_LAST_MINUTES = 5
  30. # You want show how many topics per page
  31. PER_PAGE = 12
  32. # Use cache
  33. CACHE_TYPE = 'null'
  34. CACHE_DEFAULT_TIMEOUT = 60
  35. CACHE_KEY_PREFIX = 'cache:'
  36. CACHE_REDIS_HOST = '127.0.0.1'
  37. CACHE_REDIS_PORT = '6379'
  38. CACHE_REDIS_PASSWORD = 'your password'
  39. CACHE_REDIS_DB = 2
  40. # Redis setting
  41. REDIS = {'db': 1, 'password': 'your password', 'decode_responses': True}
  42. # some middleware
  43. MIDDLEWARE = ['forums.common.middleware.GlobalMiddleware',
  44. 'forums.common.middleware.OnlineMiddleware']
  45. # Mail such as qq
  46. MAIL_SERVER = 'smtp.qq.com'
  47. MAIL_PORT = 25
  48. MAIL_USE_TLS = True
  49. MAIL_USE_SSL = False
  50. MAIL_USERNAME = "your email"
  51. MAIL_PASSWORD = "your password"
  52. MAIL_DEFAULT_SENDER = 'your email'
  53. # MAIL_SUPPRESS_SEND = True
  54. # Log,if SEND_LOGS is True when web app has some error happen(500)
  55. # the email will be sent to RECEIVER
  56. SEND_LOGS = True
  57. RECEIVER = ["yourname@gmail.com"]
  58. INFO_LOG = "info.log"
  59. ERROR_LOG = "error.log"
  60. SERVER_NAME = 'localhost:5000'
  61. SUBDOMAIN = {'forums': True, 'docs': True}
  62. # Sql
  63. SQLALCHEMY_DATABASE_URI = 'postgresql://postgres:password@localhost/your_db'
  64. WHOOSH_BASE = 'search.db'
  65. # SQLALCHEMY_ECHO = True
  66. # SQLALCHEMY_DATABASE_URI = 'sqlite:///test.db'
  67. # SQLALCHEMY_DATABASE_URI = 'mysql://username:password@server/db'
  68. # avatar upload folder
  69. AVATAR_FOLDER = 'avatars/'
  70. # Locale
  71. LANGUAGES = {'en': 'English', 'zh': 'Chinese'}
  72. SITE = {'title': 'Honmaple', 'description': '爱生活,更爱自由', 'avatar': ''}