basic create_app() and configuration scaffolding
This commit is contained in:
parent
aa8bce1521
commit
a28f27206b
21
incorporealcms/__init__.py
Normal file
21
incorporealcms/__init__.py
Normal file
@ -0,0 +1,21 @@
|
||||
"""create_app application factory function and similar things."""
|
||||
import os
|
||||
|
||||
from flask import Flask
|
||||
|
||||
|
||||
def create_app(test_config=None):
|
||||
app = Flask(__name__, instance_relative_config=True)
|
||||
|
||||
# if it doesn't already exist, create the instance folder
|
||||
os.makedirs(app.instance_path, exist_ok=True)
|
||||
|
||||
if test_config is None:
|
||||
# load defaults from config provided with the application
|
||||
app.config.from_object('incorporealcms.config.Config')
|
||||
# load specific instance configurations
|
||||
app.config.from_pyfile('config.py', silent=True)
|
||||
else:
|
||||
app.config.from_mapping(test_config)
|
||||
|
||||
return app
|
11
incorporealcms/config.py
Normal file
11
incorporealcms/config.py
Normal file
@ -0,0 +1,11 @@
|
||||
"""Default configuration."""
|
||||
|
||||
|
||||
class Config(object):
|
||||
"""Represent the default configuration.
|
||||
|
||||
Reminder: this should be overwritten in the instance config.py, not here!
|
||||
"""
|
||||
|
||||
DEBUG = False
|
||||
TESTING = False
|
Loading…
x
Reference in New Issue
Block a user