コード例 #1
0
ファイル: runserver.py プロジェクト: taimur97/Feeder
def ensure_db_exists():
    '''
    Tell Flask to create the database which is configured if it doesn't exist
    '''
    filepath = app.config.get('FEEDER_DATABASE', './feeder.db')
    filepath = os.path.abspath(filepath)

    if not os.path.isfile(filepath):
        from feeder.database import db
        db.create_all()
        print("Database was created successfully")
コード例 #2
0
ファイル: cli.py プロジェクト: webmasteraxe/Feeder
def ensure_db_exists():
    '''
    Tell Flask to create the database which is configured if it doesn't exist
    '''
    import feeder.rest
    from feeder.database import app, db

    filepath = app.config.get('FEEDER_DATABASE', '/var/lib/feeder/feeder.db')
    filepath = os.path.abspath(filepath)

    if not os.path.isfile(filepath):
        print("Ensuring database")
        db.create_all()
        print("Database was created successfully")
コード例 #3
0
ファイル: createdb.py プロジェクト: ccciit/Feeder
# -*- coding: utf-8 -*-
'''
Usage
    python createdb.py -c /path/to/config.yaml

Creates the database whose location is specified by the config file.
See config-sample.yaml for details.
'''
import sys
from feeder import read_config


if __name__ == '__main__':
    if len(sys.argv) != 3 or sys.argv[1] != '-c':
        exit(__doc__)

    configfile = sys.argv[2]
    read_config(configfile)

    import feeder.rest
    from feeder.database import db
    db.create_all()

    exit("Database created successfully")
コード例 #4
0
ファイル: createdb.py プロジェクト: taimur97/Feeder
# -*- coding: utf-8 -*-
'''
Usage
    python createdb.py -c /path/to/config.yaml

Creates the database whose location is specified by the config file.
See config-sample.yaml for details.
'''
import sys
from feeder import read_config

if __name__ == '__main__':
    if len(sys.argv) != 3 or sys.argv[1] != '-c':
        exit(__doc__)

    configfile = sys.argv[2]
    read_config(configfile)

    import feeder.rest
    from feeder.database import db
    db.create_all()

    exit("Database created successfully")