def drop_tables(): """ Create database tables """ check_settings.set_settings() connection.initialize_connection(echo=DEBUG) logger.info("Dropping tables") for table in tables.TABLES: logger.info("Table: %s" % table.__tablename__) connection.conn.drop_tables() logger.info("All tables dropped")
from webtest import TestApp, AppError from jsonschema import validate as jsonschema_validate from jsonschema.exceptions import ValidationError as JSONValidationError import json import time import unittest import logging import logging.config logger = logging.getLogger() logger.setLevel(logging.ERROR) # Initialize database connection check_settings.set_settings() logger.setLevel(logging.DEBUG) connection.initialize_connection(unittest=True) # TODO: # - Mute logging logging.config.dictConfig({'version': 1, 'disable_existing_loggers': True}) settings.DEBUG = True ### JSON validation ### class JSONValidatorObject(object): TYPE = 'invalidtype'
#!/usr/bin/env python # encoding: utf-8 from lib import check_settings from lib import renki, renki_settings as settings from lib.database.connection import initialize_connection, session from lib.history_meta import versioned_session # Importing routes and modules registers also tables import lib.auth.db import routes import modules from bottle import run import logging if __name__ == '__main__': check_settings.set_settings() logger = logging.getLogger('server') # Run server logger.info("Starting server") initialize_connection() versioned_session(session.session()) run(renki.app, host=settings.BIND_HOST, port=settings.BIND_PORT, debug=settings.DEBUG, reloader=True) logger.info("Server stopped")
def init(): check_settings.set_settings() connection.initialize_connection(echo=DEBUG)