import os import sys import changedb_conf as conf project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) data_path = os.path.join(project_root, 'data') sys.path.insert(0, project_root) from aip import make sapp = make( config={'SQLALCHEMY_DATABASE_URI': conf.src_uri}, dbmode=True, instance_path=data_path, instance_relative_config=True ) dapp = make( config={'SQLALCHEMY_DATABASE_URI': conf.dst_uri}, dbmode=True, instance_path=data_path, instance_relative_config=True ) src = sapp.store.db dst = dapp.store.db for name in ( 'meta', 'imgur', 'immio', 'entry', 'post',
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os DATA_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), 'data')) from logbook.compat import redirect_logging redirect_logging() from aip import make from aip.log import RedisPub with RedisPub(): app = make( instance_path=DATA_PATH, instance_relative_config=True ) from werkzeug.contrib.fixers import ProxyFix app.wsgi_app = ProxyFix(app.wsgi_app)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from logbook.compat import redirect_logging redirect_logging() import os if __name__ == "__main__": from aip import make from aip.log import RedisPub with RedisPub(): app = make( instance_path=os.path.join(os.path.dirname(__file__), 'data'), instance_relative_config=True ) app.run('0.0.0.0', debug=True, threaded=True)