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

Commit

Permalink
Make init_for calls automatic. Fixes #2.
Browse files Browse the repository at this point in the history
  • Loading branch information
jace committed May 4, 2017
1 parent b1d2a6f commit 2330d6c
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 35 deletions.
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 Listman'
#: Site id (for network bar)
Expand Down
13 changes: 6 additions & 7 deletions listman/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@


# Configure the app
def init_for(env):
coaster.app.init_app(app, env)
db.init_app(app)
db.app = app
baseframe.init_app(app, requires=['baseframe-bs3', 'listman'])
lastuser.init_app(app)
lastuser.init_usermanager(UserManager(db, models.User))
coaster.app.init_app(app)
db.init_app(app)
db.app = app
baseframe.init_app(app, requires=['baseframe-bs3', 'listman'])
lastuser.init_app(app)
lastuser.init_usermanager(UserManager(db, models.User))
4 changes: 2 additions & 2 deletions manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
import listman.forms as forms
import listman.views as views
from listman.models import db
from listman import app, init_for
from listman import app


if __name__ == '__main__':
db.init_app(app)
manager = init_manager(app, db, init_for, listman=listman, models=models, forms=forms, views=views)
manager = init_manager(app, db, listman=listman, models=models, forms=forms, views=views)
manager.run()
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
Flask
Flask-SQLAlchemy
Flask-Script==0.5.3
Flask-RQ
https://github.com/hasgeek/coaster/archive/master.zip
https://github.com/hasgeek/baseframe/archive/master.zip
https://github.com/hasgeek/flask-lastuser/archive/master.zip
https://github.com/jace/flask-alembic/archive/master.zip
2 changes: 1 addition & 1 deletion rq.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

rqworker -c rqdev listman
rqworker -c rqinit listman
16 changes: 0 additions & 16 deletions rqdev.py

This file was deleted.

3 changes: 1 addition & 2 deletions rqinit.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from urlparse import urlparse

from listman import init_for, app
from listman import app

init_for('production')
REDIS_URL = app.config.get('REDIS_URL', 'redis://localhost:6379/0')

# REDIS_URL is not taken by setup_default_arguments function of rq/scripts/__init__.py
Expand Down
5 changes: 2 additions & 3 deletions runserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
# -*- coding: utf-8 -*-

import sys
from listman import app, init_for
init_for('dev')
from listman import app

try:
port = int(sys.argv[1])
except (IndexError, ValueError):
port = 8000
app.run('0.0.0.0', port=port, debug=True)
app.run('0.0.0.0', port=port)
1 change: 1 addition & 0 deletions runtests.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
export FLASK_ENV="TESTING"
coverage run `which nosetests`
coverage report
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 listman import app as application, init_for
init_for('production')
from listman import app as application

0 comments on commit 2330d6c

Please sign in to comment.