Beispiel #1
0
def get_config(confpath):

    HERE = os.path.abspath(os.path.dirname(__file__))
    CONFD_PATH = os.path.join(HERE, confpath)
    from rhaptos2.user.configuration import (
        find_configuration_file,
        Configuration,
        )
    config = Configuration.from_file(CONFD_PATH)
    backend.initdb(config)  
    return config
Beispiel #2
0
def runner(app_factory, args=None):
    """Run the web application"""
    # Find the configuration file.
    config_file = args.config and args.config or find_configuration_file()
    if config_file is None:
        raise Exception("The application configuration file "
                        "could not be found")

    config = Configuration.from_file(config_file)
    app = app_factory(config)

    # This is very Flask specific, but this is the best place to run
    #   the application.
    app.run(host=args.host,
            port=args.port,
            debug=args.debug,
            use_reloader=False,
            )
Beispiel #3
0
from rhaptos2.user import backend, usermodel
from rhaptos2.user.backend import db_session
import os
### This probably not best instantiated here. But nose not easy to work around




HERE = os.path.abspath(os.path.dirname(__file__))
CONFD_PATH = os.path.join(HERE, "../../local.ini")
from rhaptos2.user.configuration import (
    find_configuration_file,
    Configuration,
    )
config = Configuration.from_file(CONFD_PATH)
backend.initdb(config)  #only do thios once per applicaiton not per test


############### admin tools for nose
def setup():
    clean_dbase() 
    populate_dbase()
            
def teardown():
    backend.db_session.remove()

def clean_dbase():
    conn = psycopg2.connect("""dbname='%(pgdbname)s'\
                             user='******' \
                             host='%(pghost)s' \