WIP: dont use flask
This commit is contained in:
parent
679411abc5
commit
0c08d37c56
9 changed files with 133 additions and 89 deletions
16
oml/setup.py
16
oml/setup.py
|
|
@ -1,9 +1,25 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vi:si:et:sw=4:sts=4:ts=4
|
||||
|
||||
import os
|
||||
|
||||
import settings
|
||||
from db import session
|
||||
|
||||
from user.models import List, User
|
||||
|
||||
|
||||
def create_db():
|
||||
if not os.path.exists(settings.db_path):
|
||||
print 'create db'
|
||||
session.connection().execute("PRAGMA journal_mode=WAL")
|
||||
session.commit()
|
||||
upgrade_db('0')
|
||||
|
||||
def upgrade_db(old):
|
||||
if old <= '20140527-120-3cb9819':
|
||||
create_index('ix_find_findvalue', 'find', ['findvalue'], unique=False)
|
||||
|
||||
def create_default_lists(user_id=None):
|
||||
user_id = user_id or settings.USER_ID
|
||||
user = User.get_or_create(user_id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue