Exemple #1
0
def create_app(config_filename=None):
    app = Flask(__name__, instance_relative_config=True)
    if app.config.from_pyfile("settings.conf", silent=True):
        print "Settings loaded from local instance"
    if app.config.from_envvar("RSVP_CONF", silent=True):
        print "Settings loaded from ENVVAR"
    if app.config["DEBUG"]:
        app.debug = True

    log_formatter = logging.Formatter("%(asctime)s [%(levelname)s] %(message)s")
    root_logger = logging.getLogger("werkzeug")
    if app.config["DEBUG"]:
        root_logger.setLevel(logging.DEBUG)
    file_handler = logging.FileHandler("{}/{}".format(app.config["LOGDIR"], "rsvp.log"))
    file_handler.setFormatter(log_formatter)
    root_logger.addHandler(file_handler)
    console_handler = logging.StreamHandler()
    console_handler.setFormatter(log_formatter)
    root_logger.addHandler(console_handler)

    from extensions import db
    import models
    db.init_app(app)
    models.create_all(app)

    from views import views_bp
    app.register_blueprint(views_bp)
    return app
Exemple #2
0
from bot import Bot
from drawing import Artist
import threading
from models import create_all
import turtle


def start_bot(artist):
	bot = Bot(artist)
	bot.start()


if __name__ == '__main__':
	create_all()

	artist = Artist(10)
	artist.draw_grid()

	# start bot on a separate thread
	bot_thread = threading.Thread(target=start_bot, args=(artist,), daemon=False)
	bot_thread.start()

	# drawing has to be done on the main thread
	turtle.done()
Exemple #3
0
#!/usr/bin/env python
# encoding: utf-8
import os, logging
from smisk.mvc import main
import controllers, models

if __name__ == '__main__':
  models.setup_all()
  models.create_all()
  main(
    appdir=os.path.dirname(os.path.dirname(__file__)),
    log_level=logging.DEBUG
  )
Exemple #4
0
# -*- coding: utf-8 -*-
"""Файл для инициализации/установки бота.
Создаёт базу данных, создаёт файл config.ini из шаблона config_skeleton.ini.
Посе запуска необходимо будет внести Token в config.ini

PaVel 09.2016
"""
import shutil, os

if not os.path.exists(r'config.ini'):
    shutil.copy(r'config_skeleton.ini', r'config.ini')

import models
models.create_all()
def initialise_db():
    print("Initialising database...", end="")
    sys.stdout.flush()
    init(config["connection_string"])
    create_all()
    print("Done!")
Exemple #6
0
 def clean_up():
     """Drop tables and create again to remove all test data."""
     drop_all_tables()
     create_all()
Exemple #7
0
 def tearDown(self):
     """Cleans up after the test."""
     drop_all_tables()
     create_all()
Exemple #8
0
def create_db(app):
    create_all(app)
Exemple #9
0
# -*- coding: utf-8 -*-

from models import create_all, drop_all

drop_all()
create_all()

if False:
    from application import db
    from models import List, Task, User

    user = User(name='test',
        hash='0ae383ef099312fa89a11ad8549e37663203ff9c',
        salt='a94a8fe5ccb19ba61c4c0873d391e987982fbbd3')

    # test: TODO
    customList1 = List(title='123cd0b0',
        rck='27783a2807f0def1e0f58cdfffb6199d5775319f', user=user)
    # test: Groceries
    customList2 = List(title='8bf5631bff73bb312f',
        rck='b87fc9682e38a6a6e1217eea718992533b586a3d', user=user)

    customList1Tasks = [
        Task(list=customList1, priority=1,
            title='835f46f115a87309929c9efdbe70be',
            rck='0582086d3cdc0fe5a3e2f4ef017c541fc7c96cc7', state='open'),
        Task(list=customList1, priority=2,
            title='88a1bfe9f068bc185b07450dd86399',
            rck='3bd059ea8eab6ac40717fe3359820625599c27b4', state='open'),
        Task(list=customList1, priority=3,
            title='0468140554ab3d204af8f7b7c102d0',
Exemple #10
0
 def setUp(self):
     conn = hub.connect('sqlite:///:memory:')
     with hub.transaction() as tx:
         models.create_all(tx)
def initialise_db():
    print("Initialising database...", end="")
    sys.stdout.flush()
    init(config["connection_string"])
    create_all()
    print("Done!")
Exemple #12
0
 def __call__(self, parser, namespace, values, option_string=None):
     ctx.push()
     models.create_all()
     ctx.pop()
     parser.exit(0)
Exemple #13
0
def create_and_update_db():
    models.create_all(engine)
Exemple #14
0
def create_and_update_db():
    models.create_all(engine)