Browse Source

Renamed base config to default

sh4nks 11 years ago
parent
commit
5e516e8369

+ 3 - 3
flaskbb/app.py

@@ -72,9 +72,9 @@ def configure_app(app, config):
 
 
     # Get the configuration file
     # Get the configuration file
     if config is None:
     if config is None:
-        from flaskbb.configs.development import DevelopmentConfig
-        app.config.from_object(DevelopmentConfig)
-        app.logger.info("No configuration specified. Using Development config")
+        from flaskbb.configs.default import DefaultConfig
+        app.config.from_object(DefaultConfig)
+        app.logger.info("No configuration specified. Using the Default config")
     else:
     else:
         app.config.from_object(config)
         app.config.from_object(config)
 
 

+ 26 - 1
flaskbb/configs/base.py → flaskbb/configs/default.py

@@ -12,7 +12,7 @@
 import os
 import os
 
 
 
 
-class BaseConfig(object):
+class DefaultConfig(object):
 
 
     # Get the app root path
     # Get the app root path
     #            <_basedir>
     #            <_basedir>
@@ -57,10 +57,35 @@ class BaseConfig(object):
     CACHE_TYPE = "simple"
     CACHE_TYPE = "simple"
     CACHE_DEFAULT_TIMEOUT = 60
     CACHE_DEFAULT_TIMEOUT = 60
 
 
+
+    ## Captcha
+    RECAPTCHA_ENABLE = False
+    RECAPTCHA_USE_SSL = False
+    RECAPTCHA_PUBLIC_KEY = "your_public_recaptcha_key"
+    RECAPTCHA_PRIVATE_KEY = "your_private_recaptcha_key"
+    RECAPTCHA_OPTIONS = {"theme": "white"}
+
+    ## Mail
+    MAIL_SERVER = "localhost"
+    MAIL_PORT = 25
+    MAIL_USE_SSL = False
+    MAIL_USE_TLS = False
+    MAIL_USERNAME = "noreply@example.org"
+    MAIL_PASSWORD = ""
+    MAIL_DEFAULT_SENDER = ("Default Sender", "noreply@example.org")
+    ADMINS = ["admin@example.org"]
+
+    ## App specific configs
     # Pagination
     # Pagination
+    # How many posts per page are displayed
     POSTS_PER_PAGE = 10
     POSTS_PER_PAGE = 10
+    # How many topics per page are displayed
     TOPICS_PER_PAGE = 10
     TOPICS_PER_PAGE = 10
+    # How many users per page are displayed.
+    # This affects mainly the memberlist
     USERS_PER_PAGE = 10
     USERS_PER_PAGE = 10
 
 
+    # How long the use can be inactive before he is marked as offline
     LAST_SEEN = 15
     LAST_SEEN = 15
+    # The length of the topic title in characters on the index
     TITLE_LENGTH = 15
     TITLE_LENGTH = 15

+ 4 - 4
flaskbb/configs/development.py.example

@@ -7,17 +7,17 @@
     :copyright: (c) 2013 by the FlaskBB Team.
     :copyright: (c) 2013 by the FlaskBB Team.
     :license: BSD, see LICENSE for more details.
     :license: BSD, see LICENSE for more details.
 """
 """
-from flaskbb.configs.base import BaseConfig
+from flaskbb.configs.default import DefaultConfig
 
 
 
 
-class DevelopmentConfig(BaseConfig):
+class DevelopmentConfig(DefaultConfig):
 
 
     # Indicates that it is a dev environment
     # Indicates that it is a dev environment
     DEBUG = True
     DEBUG = True
 
 
     # SQLAlchemy connection options
     # SQLAlchemy connection options
-    SQLALCHEMY_DATABASE_URI = 'sqlite:///' + BaseConfig._basedir + '/' + \
-                              BaseConfig.PROJECT + ".sqlite"
+    SQLALCHEMY_DATABASE_URI = 'sqlite:///' + DefaultConfig._basedir + '/' + \
+                              DefaultConfig.PROJECT + ".sqlite"
     SQLALCHEMY_ECHO = True
     SQLALCHEMY_ECHO = True
 
 
     # Security
     # Security

+ 10 - 4
flaskbb/configs/production.py.example

@@ -7,18 +7,18 @@
     :copyright: (c) 2013 by the FlaskBB Team.
     :copyright: (c) 2013 by the FlaskBB Team.
     :license: BSD, see LICENSE for more details.
     :license: BSD, see LICENSE for more details.
 """
 """
-from flaskbb.configs.base import BaseConfig
+from flaskbb.configs.default import DefaultConfig
 
 
 
 
-class ProductionConfig(BaseConfig):
+class ProductionConfig(DefaultConfig):
 
 
     ## Database
     ## Database
     # If no SQL service is choosen, it will fallback to sqlite
     # If no SQL service is choosen, it will fallback to sqlite
     # For PostgresSQL:
     # For PostgresSQL:
     #SQLALCHEMY_DATABASE_URI = "postgresql://localhost/example"
     #SQLALCHEMY_DATABASE_URI = "postgresql://localhost/example"
     # For SQLite:
     # For SQLite:
-    #SQLALCHEMY_DATABASE_URI = 'sqlite:///' + BaseConfig._basedir + '/' + \
-    #                          BaseConfig.PROJECT + ".sqlite"
+    #SQLALCHEMY_DATABASE_URI = 'sqlite:///' + DefaultConfig._basedir + '/' + \
+    #                          DefaultConfig.PROJECT + ".sqlite"
 
 
     ## Security
     ## Security
     # This is the secret key that is used for session signing.
     # This is the secret key that is used for session signing.
@@ -72,10 +72,16 @@ class ProductionConfig(BaseConfig):
 
 
     ## FlaskBB Configs
     ## FlaskBB Configs
     # Pagination
     # Pagination
+    # How many posts per page are displayed
     POSTS_PER_PAGE = 10
     POSTS_PER_PAGE = 10
+    # How many topics per page are displayed
     TOPICS_PER_PAGE = 10
     TOPICS_PER_PAGE = 10
+    # How many users per page are displayed.
+    # This affects mainly the memberlist
     USERS_PER_PAGE = 10
     USERS_PER_PAGE = 10
 
 
     # How long (in minutes) a user needs to be inactive
     # How long (in minutes) a user needs to be inactive
     # to be shown as offline.
     # to be shown as offline.
     LAST_SEEN = 15
     LAST_SEEN = 15
+    # The length of the topic title in characters on the index
+    TITLE_LENGTH = 15

+ 7 - 2
manage.py

@@ -17,13 +17,18 @@ from flask import current_app
 from flask.ext.script import Manager, Shell, Server
 from flask.ext.script import Manager, Shell, Server
 
 
 from flaskbb import create_app
 from flaskbb import create_app
-from flaskbb.configs.development import DevelopmentConfig, BaseConfig
 from flaskbb.extensions import db
 from flaskbb.extensions import db
 
 
 from flaskbb.user.models import User, Group
 from flaskbb.user.models import User, Group
 from flaskbb.forum.models import Post, Topic, Forum, Category
 from flaskbb.forum.models import Post, Topic, Forum, Category
 
 
-app = create_app(DevelopmentConfig)
+# Use the development configuration if available
+try:
+    from flaskbb.configs.development import DevelopmentConfig as Config
+except ImportError:
+    from flaskbb.configs.default import DefaultConfig as Config
+
+app = create_app(Config)
 manager = Manager(app)
 manager = Manager(app)
 
 
 # Run local server
 # Run local server