diff --git a/{{cookiecutter.repo_name}}/manage.py b/{{cookiecutter.repo_name}}/manage.py index 4fe3a76..57a7b66 100644 --- a/{{cookiecutter.repo_name}}/manage.py +++ b/{{cookiecutter.repo_name}}/manage.py @@ -10,7 +10,7 @@ from {{cookiecutter.repo_name}}.models import db env = os.environ.get("{{cookiecutter.repo_name | upper }}_ENV", 'prod') app = create_app("{{cookiecutter.repo_name}}.settings.{0}Config" - .format(env.capitalize()), env) + .format(env.capitalize())) manager = Manager(app) TEST_CMD = "nosetests" diff --git a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/app.py b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/app.py index 4c5f63c..feca3fd 100644 --- a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/app.py +++ b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/app.py @@ -10,16 +10,14 @@ from {{cookiecutter.repo_name}}.models import db assets_env = Environment() -def create_app(config_object, env): +def create_app(config_object): '''An application factory, as explained here: http://flask.pocoo.org/docs/patterns/appfactories/ :param config_object: The configuration object to use. - :param env: A string, the current environment. Either "dev" or "prod" ''' app = Flask(__name__) app.config.from_object(config_object) - app.config['ENV'] = env # Initialize SQLAlchemy db.init_app(app) # Register asset bundles diff --git a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/main.py b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/main.py index 5652835..d6c2778 100644 --- a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/main.py +++ b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/main.py @@ -12,4 +12,4 @@ if __name__ == '__main__': # Get the environment setting from the system environment variable env = os.environ.get("{{cookiecutter.repo_name | upper}}_ENV", "prod") app = create_app("{{cookiecutter.repo_name}}.settings.{env}Config" - .format(env=env.capitalize()), env) + .format(env=env.capitalize())) diff --git a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/modules/public.py b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/modules/public.py index b105812..a38b4f6 100644 --- a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/modules/public.py +++ b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/modules/public.py @@ -47,7 +47,6 @@ def register(): flash("Thank you for registering. You can now log in.", 'success') return redirect(url_for('public.home')) except IntegrityError as err: - print(err) flash("That username and/or email already exists. Try again.", 'warning') else: flash_errors(form) diff --git a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/settings.py b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/settings.py index 8195659..4727f8f 100644 --- a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/settings.py +++ b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/settings.py @@ -7,11 +7,13 @@ class Config(object): PROJECT_ROOT = os.path.abspath(os.path.join(APP_DIR, os.pardir)) class ProdConfig(Config): + ENV = 'prod' DEBUG = False SQLALCHEMY_DATABASE_URI = 'postgresql://localhost/example' SQLALCHEMY_ECHO = False class DevConfig(Config): + ENV = 'dev' DEBUG = True DB_NAME = "dev.db" # Put the db file in project root diff --git a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/tests/test_models.py b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/tests/test_models.py index 34c8cf3..93554dc 100644 --- a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/tests/test_models.py +++ b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/tests/test_models.py @@ -13,7 +13,7 @@ class TestUser(TestCase): SQLALCHEMY_DATABASE_URI = 'sqlite://' def create_app(self): - app = create_app(self, 'testing') + app = create_app(self) with app.app_context(): db.create_all() return app