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

Commit

Permalink
fix #55
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyas-satish committed May 4, 2017
1 parent fb2abc7 commit 2f3d11d
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 32 deletions.
1 change: 1 addition & 0 deletions instance/settings-sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,4 @@
DOATTEND_PASS = ''

PRINTER_NAME = 'Brother-QL-570'
DEBUG = True
11 changes: 2 additions & 9 deletions manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from flask_alembic import ManageMigrations, FlaskAlembicConfig
from alembic import command

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

Expand All @@ -21,34 +21,28 @@ def get_options(self):
)

def handle(self, *args, **kwargs):
if 'env' in kwargs:
init_for(kwargs.pop('env'))
super(InitedServer, self).handle(*args, **kwargs)


class InitedMigrations(ManageMigrations):
def run(self, args):
if len(args) and not args[0].startswith('-'):
init_for(args[0])
super(InitedMigrations, self).run(args[1:])


@manager.shell
def _make_context():
return dict(app=app, db=db, models=models, init_for=init_for)
return dict(app=app, db=db, models=models)


@database.option('-e', '--env', default='dev', help="runtime environment [default 'dev']")
def drop(env):
"Drops database tables"
init_for(env)
if prompt_bool("Are you sure you want to lose all your data?"):
db.drop_all()

@database.option('-e', '--env', default='dev', help="runtime environment [default 'dev']")
def create(env):
"Creates database tables from sqlalchemy models"
init_for(env)
db.create_all()
config = FlaskAlembicConfig("alembic.ini")
command.stamp(config, "head")
Expand All @@ -59,7 +53,6 @@ def setversion(env):
Manually set the alembic version of the
database to the provided value.
'''
init_for(env)
config = FlaskAlembicConfig("alembic.ini")
version = raw_input("Enter the alembic version to be set:")
command.stamp(config, version)
Expand Down
15 changes: 7 additions & 8 deletions peopleflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@
from .models import db
from .views import nav

def init_for(env):
coaster.app.init_app(app, env)
db.init_app(app)
db.app = app
baseframe.init_app(app, requires=['baseframe', 'jquery.ui', 'toastr', 'indicators', 'peopleflow', 'cooldown'])
lastuser.init_app(app)
lastuser.init_usermanager(UserManager(db, models.User))
nav.init_app(app)
coaster.app.init_app(app)
db.init_app(app)
db.app = app
baseframe.init_app(app, requires=['baseframe', 'jquery.ui', 'toastr', 'indicators', 'peopleflow', 'cooldown'])
lastuser.init_app(app)
lastuser.init_usermanager(UserManager(db, models.User))
nav.init_app(app)
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ https://github.com/hasgeek/coaster/archive/master.zip
https://github.com/hasgeek/baseframe/archive/master.zip
Flask-SQLAlchemy
https://github.com/hasgeek/flask-lastuser/archive/master.zip
Flask-Script
https://github.com/jace/flask-alembic/archive/master.zip
Flask-RQ
Flask-Mail
python-dateutil
Expand Down
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 peopleflow
rqworker -c rqinit peopleflow
2 changes: 0 additions & 2 deletions rqdev.py

This file was deleted.

16 changes: 14 additions & 2 deletions rqinit.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
from peopleflow import init_for
init_for('production')
from urlparse import urlparse

from peopleflow import app

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
# so, parse that into pieces and give it

r = urlparse(REDIS_URL)
REDIS_HOST = r.hostname
REDIS_PORT = r.port
REDIS_PASSWORD = r.password
REDIS_DB = 0
3 changes: 1 addition & 2 deletions runserver.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python
import sys
from peopleflow import app, init_for
init_for('dev')
from peopleflow import app

try:
port = int(sys.argv[1])
Expand Down
4 changes: 0 additions & 4 deletions runtests.py

This file was deleted.

3 changes: 1 addition & 2 deletions website.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
import os.path

sys.path.insert(0, os.path.dirname(__file__))
from peopleflow import app as application, init_for
init_for('production')
from peopleflow import app as application

0 comments on commit 2f3d11d

Please sign in to comment.