Skip to content
This repository has been archived by the owner on May 16, 2020. It is now read-only.

Commit

Permalink
making init_app implicit. Fixes #282
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephanie Br authored and Stephanie Br committed May 4, 2017
1 parent f5ae90b commit 3c4fc56
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 16 deletions.
13 changes: 6 additions & 7 deletions hacknight/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@
assets['hacknight.js'][version] = 'js/scripts.js'


def init_for(env):
coaster.app.init_app(app, env)
baseframe.init_app(app, requires=['baseframe', 'toastr', 'hacknight'], bundle_js=assets.require('leaflet.js'), bundle_css=assets.require('leaflet.css'))
lastuser.init_app(app)
lastuser.init_usermanager(UserManager(hacknight.models.db, hacknight.models.User))
mail.init_app(app)
app.config['tz'] = timezone(app.config['TIMEZONE'])
coaster.app.init_app(app)
baseframe.init_app(app, requires=['baseframe', 'toastr', 'hacknight'], bundle_js=assets.require('leaflet.js'), bundle_css=assets.require('leaflet.css'))
lastuser.init_app(app)
lastuser.init_usermanager(UserManager(hacknight.models.db, hacknight.models.User))
mail.init_app(app)
app.config['tz'] = timezone(app.config['TIMEZONE'])
2 changes: 2 additions & 0 deletions instance/settings-sample.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
#: Debug mode (put this value in development.py only, never in settings.py)
DEBUG = True
#: Site title
SITE_TITLE = 'HasGeek App'
#: Site id (for network bar)
Expand Down
4 changes: 2 additions & 2 deletions manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

from coaster.manage import init_manager

from hacknight import app, init_for
from hacknight import app
from hacknight.models import db


if __name__ == "__main__":
manager = init_manager(app, db, init_for)
manager = init_manager(app, db)
manager.run()
5 changes: 2 additions & 3 deletions runserver.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python

from hacknight import app, init_for
init_for('development')
app.run('0.0.0.0', debug=True, port=8100)
from hacknight import app
app.run('0.0.0.0', port=8100)
1 change: 1 addition & 0 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
import nose

os.environ['ENVIRONMENT'] = "testing"
os.environ['FLASK_ENV'] = "testing"
nose.main()
3 changes: 1 addition & 2 deletions website.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import sys
import os.path
sys.path.insert(0, os.path.dirname(__file__))
from hacknight import app as application, init_for
init_for('production')
from hacknight import app as application
3 changes: 1 addition & 2 deletions website.wsgi
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import sys
import os.path
sys.path.insert(0, os.path.dirname(__file__))
from hacknight import app as application, init_for
init_for('production')
from hacknight import app as application

0 comments on commit 3c4fc56

Please sign in to comment.