def fixtures_command(): app = create_app() init_db_command(app) db.session.add_all(fixtures.db_objects()) db.session.commit() with app.test_request_context(): fixtures.init_couchdb(app.config)
def runserver_command(host='127.0.0.1', port=5000): app = create_app() # scriptine removed sub-command from argv, # but Flask reloader needs complete sys.argv sys.argv[1:1] = ['runserver'] from werkzeug.serving import run_simple, WSGIRequestHandler # use custom request handler to force HTTP/1.1 # needed for chunked encoding in CouchDB AuthProxy class HTTP11WSGIRequestHandler(WSGIRequestHandler): protocol_version = 'HTTP/1.1' run_simple(application=app, hostname=host, port=port, threaded=True, request_handler=HTTP11WSGIRequestHandler, use_reloader=True)
COUCH_DB_ADMIN_USER = '******' COUCH_DB_ADMIN_PASSWORD = '******' MAIL_SERVER = "smtp.example.org" MAIL_USERNAME = '******' MAIL_PASSWORD = '******' DEFAULT_MAIL_SENDER = "GBI Server <*****@*****.**>" COUCH_DB_URL = "http://gbiserver.omniscale.net/couchdb" GBI_CLIENT_DOWNLOAD_URL = "http://download.omniscale.de/geobox/dist/setup-geobox-0.2.8.exe" from gbi_server import create_app application = create_app(config=GBIConfig) # logging configuration import logging from logging import Formatter, handlers formatter = Formatter('%(asctime)s - %(levelname)s - %(name)s - %(message)s [@%(pathname)s:%(lineno)s]') file_handler = handlers.RotatingFileHandler('/var/log/gbi/gbi-server.log', maxBytes=100000, backupCount=10) file_handler.setLevel(logging.INFO) file_handler.setFormatter(formatter) application.logger.addHandler(file_handler) gbi_server_logger = logging.getLogger('gbi_server') gbi_server_logger.setLevel(logging.INFO)
def init_db_command(app=None): if not app: app = create_app() db.app = app db.drop_all() db.create_all()
COUCH_DB_ADMIN_USER = '******' COUCH_DB_ADMIN_PASSWORD = '******' MAIL_SERVER = "smtp.example.org" MAIL_USERNAME = '******' MAIL_PASSWORD = '******' DEFAULT_MAIL_SENDER = "GeoBox-Server <*****@*****.**>" COUCH_DB_URL = "http://gbiserver.omniscale.net/couchdb" GBI_CLIENT_DOWNLOAD_URL = "http://download.omniscale.de/geobox/dist/setup-geobox-0.2.8.exe" from gbi_server import create_app application = create_app(config=GBIConfig) # logging configuration import logging from logging import Formatter, handlers formatter = Formatter( '%(asctime)s - %(levelname)s - %(name)s - %(message)s [@%(pathname)s:%(lineno)s]' ) file_handler = handlers.RotatingFileHandler('/var/log/gbi/gbi-server.log', maxBytes=100000, backupCount=10) file_handler.setLevel(logging.INFO) file_handler.setFormatter(formatter)