示例#1
0
def init_database(verbose=False, dumpfilepath=None):
    db = utils.get_db(create=True)
    utils.wipeout_database(db)
    if verbose:
        print('wiped out database', file=sys.stderr)
    utils.load_designs(db)
    if verbose:
        print('loaded designs', file=sys.stderr)
示例#2
0
文件: dump.py 项目: pekrau/notes
#!/usr/bin/python2.7
"""notes: Dump the database into a tar file.
The dump file will be called 'dump_{ISO date}.tar.gz' using today's date.
Create the dump file in the directory specified by BACKUP_DIR variable
in the settings, otherwise in the current working directory.
"""

from __future__ import print_function, absolute_import

import os
import sys
import time

from notes import settings
from notes import utils


if __name__ == '__main__':
    args = utils.get_args('Dump database into tar file.')
    utils.load_settings(filepath=args.settings, verbose=args.verbose)
    db = utils.get_db()
    filepath = "dump_{}.tar.gz".format(time.strftime("%Y-%m-%d"))
    try:
        filepath = os.path.join(settings['BACKUP_DIR'], filepath)
    except KeyError:
        pass
    utils.dump(db, filepath, verbose=args.verbose)
示例#3
0
#!/usr/bin/python2.7
"notes: Load all CouchDB database design documents."

from __future__ import print_function, absolute_import

from notes import utils


if __name__ == '__main__':
    args = utils.get_args(description='Reload all CouchDB design documents.')
    utils.load_settings(filepath=args.settings, verbose=args.verbose)
    utils.load_designs(utils.get_db(), verbose=args.verbose)