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

Commit

Permalink
Make init_for calls automatic
Browse files Browse the repository at this point in the history
Fixes #13
  • Loading branch information
vidya-ram committed May 4, 2017
1 parent 806911e commit 13d8601
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 15 deletions.
11 changes: 5 additions & 6 deletions kharcha/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@


# Configure the app
def init_for(env):
coaster.app.init_app(app, env)
baseframe.init_app(app, requires=['baseframe', 'jquery.expander', 'kharcha'])
lastuser.init_app(app)
lastuser.init_usermanager(UserManager(models.db, models.User, models.Team))
app.config['tz'] = timezone(app.config['TIMEZONE'])
coaster.app.init_app(app)
baseframe.init_app(app, requires=['baseframe', 'jquery.expander', 'kharcha'])
lastuser.init_app(app)
lastuser.init_usermanager(UserManager(models.db, models.User, models.Team))
app.config['tz'] = timezone(app.config['TIMEZONE'])
4 changes: 2 additions & 2 deletions manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from coaster.manage import init_manager

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


if __name__ == '__main__':
db.init_app(app)
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,6 +1,5 @@
#!/usr/bin/env python
from kharcha import app, init_for
from kharcha import app
from kharcha.models import db
init_for('dev')
db.create_all()
app.run('0.0.0.0', debug=True, port=9000)
app.run('0.0.0.0', port=9000)
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 kharcha import app as application, init_for
init_for('production')
from kharcha 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 kharcha import app as application, init_for
init_for('production')
from kharcha import app as application

0 comments on commit 13d8601

Please sign in to comment.