Example #1
0
# -*- coding: utf-8 -*-

from flask.ext.script import Manager

from gastosabertos.extensions import db
from gastosabertos import create_app

app = create_app()
manager = Manager(app)


@manager.command
def run():
    """Run in local machine."""

    app.run()


@manager.command
def test():
    """Run tests."""

    return


@manager.command
def initdb():
    """ Init or reset database"""

    db.drop_all()
    db.create_all()
Example #2
0
def get_db():
    from gastosabertos.extensions import db
    app = create_app()
    db.app = app
    return db
Example #3
0
# -*- coding: utf-8 -*-

import sys, os, pwd

project = "gastosabertos"

# Use instance folder, instead of env variables.
# specify dev/production config
#os.environ['%s_APP_CONFIG' % project.upper()] = ''
# http://code.google.com/p/modwsgi/wiki/ApplicationIssues#User_HOME_Environment_Variable
#os.environ['HOME'] = pwd.getpwuid(os.getuid()).pw_dir

BASE_DIR = os.path.join(os.path.dirname(__file__))
# activate virtualenv
activate_this = os.path.join(BASE_DIR, "../.virtualenvs/ga/bin/activate_this.py")
execfile(activate_this, dict(__file__=activate_this))

if BASE_DIR not in sys.path:
    sys.path.append(BASE_DIR)

# give wsgi the "application"
from gastosabertos import create_app
instance_folder = os.path.join(os.path.expanduser("~"), "instance")
application = create_app(instance_folder=instance_folder)
def get_db():
    from gastosabertos.extensions import db
    app = create_app()
    db.app = app
    return db
Example #5
0
# -*- coding: utf-8 -*-

import sys, os, pwd

project = "gastosabertos"

# Use instance folder, instead of env variables.
# specify dev/production config
#os.environ['%s_APP_CONFIG' % project.upper()] = ''
# http://code.google.com/p/modwsgi/wiki/ApplicationIssues#User_HOME_Environment_Variable
#os.environ['HOME'] = pwd.getpwuid(os.getuid()).pw_dir

BASE_DIR = os.path.join(os.path.dirname(__file__))
# activate virtualenv
activate_this = os.path.join(BASE_DIR,
                             "../.virtualenvs/ga/bin/activate_this.py")
execfile(activate_this, dict(__file__=activate_this))

if BASE_DIR not in sys.path:
    sys.path.append(BASE_DIR)

# give wsgi the "application"
from gastosabertos import create_app
instance_folder = os.path.join(os.path.expanduser("~"), "instance")
application = create_app(instance_folder=instance_folder)
Example #6
0
# -*- coding: utf-8 -*-

import sys, os, pwd

project = "gastosabertos"

# Use instance folder, instead of env variables.
# specify dev/production config
#os.environ['%s_APP_CONFIG' % project.upper()] = ''
# http://code.google.com/p/modwsgi/wiki/ApplicationIssues#User_HOME_Environment_Variable
#os.environ['HOME'] = pwd.getpwuid(os.getuid()).pw_dir

BASE_DIR = os.path.join(os.path.dirname(__file__))
# activate virtualenv
activate_this = os.path.join(BASE_DIR,
                             "../.virtualenvs/ga/bin/activate_this.py")
execfile(activate_this, dict(__file__=activate_this))

if BASE_DIR not in sys.path:
    sys.path.append(BASE_DIR)

# give wsgi the "application"
from gastosabertos import create_app

application = create_app()
Example #7
0
def get_db(instance=None):
    from gastosabertos.extensions import db
    app = create_app(instance_folder=instance)
    db.app = app
    return db
                                  Maybe relative.
                                  [default: current folder]
'''
import os
import json

from docopt import docopt

from sqlalchemy import func, extract, and_
# from sqlalchemy.orm.exc import NoResultFound

from gastosabertos import create_app
from gastosabertos.extensions import db
from gastosabertos.receita.models import Revenue, RevenueCode

app = create_app()
db.app = app

revenue_levels = {}
revenue_levels[0] = Revenue.economical_category
revenue_levels[1] = Revenue.economical_subcategory
revenue_levels[2] = Revenue.source
revenue_levels[3] = Revenue.rubric
revenue_levels[4] = Revenue.paragraph
revenue_levels[5] = Revenue.subparagraph


def get_code_str(code):
    return '.'.join([str(i) for i in code if i])

Example #9
0
# coding: utf-8

import os
# import sys

# this_path = os.environ['OPENSHIFT_DATA_DIR']
# sys.path.insert(0, this_path)
# sys.path.insert(0, os.environ['OPENSHIFT_DATA_DIR'])

virtenv = os.environ['OPENSHIFT_PYTHON_DIR'] + '/virtenv/'
virtualenv = os.path.join(virtenv, 'bin/activate_this.py')
try:
    execfile(virtualenv, dict(__file__=virtualenv))
except IOError:
    pass

# os.chdir(this_path)

from gastosabertos import create_app
application = create_app(instance_folder=os.environ['OPENSHIFT_DATA_DIR'])