def _create_app(config): if not to_envvar(config): print 'Config file "{}" not found.'.format(config) sys.exit(1) app = create_app() app.migrate = Migrate(app, db) return app
import shutil sys.path.append(os.path.dirname(sys.argv[0])) parser = argparse.ArgumentParser(description='Copy flight files by one or more properties.') parser.add_argument('--config', metavar='config.ini', help='path to the configuration INI file') parser.add_argument('--flight_id', type=int, help='ID of the flight') parser.add_argument('--country_code', help='Country code of the start airport') parser.add_argument('--airport_name', help='Airport name of the start airport') parser.add_argument('--date_from', help='Date from (YYYY-MM-DD)') parser.add_argument('--date_to', help='Date to (YYYY-MM-DD)') args = parser.parse_args() if not to_envvar(args.config): parser.error('Config file "{}" not found.'.format(args.config)) from skylines import app, db from skylines.model import Airport, Flight, IGCFile from skylines.lib import files from sqlalchemy import func from time import mktime, strptime from datetime import datetime app.test_request_context().push() query = db.session.query(Flight).outerjoin(Flight.takeoff_airport).join(IGCFile) if args.flight_id is not None: print "Filter by flight id: " + str(args.flight_id)
#!/usr/bin/env python # # Wrapper script for launching Skylines as a FastCGI in lighttpd. # import os import sys import argparse from config import to_envvar parser = argparse.ArgumentParser(description='Run the SkyLines FastCGI daemon.') parser.add_argument('config_file', nargs='?', metavar='config.ini', help='path to the configuration INI file') args = parser.parse_args() if not to_envvar(args.config_file): parser.error('Config file "{}" not found.'.format(args.config_file)) sys.path.append(os.path.dirname(sys.argv[0])) from skylines import create_combined_app application = create_combined_app()
#!/usr/bin/env python import argparse from config import to_envvar, DEFAULT_CONF_PATH parser = argparse.ArgumentParser(description='Run the SkyLines debug server.') parser.add_argument('conf_path', nargs='?', metavar='config.ini', help='path to the configuration INI file') args = parser.parse_args() if not to_envvar(args.conf_path): parser.error('Config file "{}" not found.'.format(args.conf_path)) if __name__ == '__main__': from skylines import app app.add_web_components() app.run(port=8080, extra_files=[DEFAULT_CONF_PATH, args.conf_path or ''])
import argparse from config import to_envvar sys.path.append(os.path.dirname(sys.argv[0])) parser = argparse.ArgumentParser(description='Update Skylines flight paths.') parser.add_argument('--config', metavar='config.ini', help='path to the configuration INI file') parser.add_argument('--force', action='store_true', help='update all flights, not just the scheduled ones') parser.add_argument('ids', metavar='ID', nargs='*', type=int, help='Any number of flight IDs.') args = parser.parse_args() if not to_envvar(args.config): parser.error('Config file "{}" not found.'.format(args.config)) from sqlalchemy.orm import joinedload from sqlalchemy.sql.expression import or_ from skylines import db from skylines.model import Flight def do(flight): print flight.id return flight.update_flight_path() def apply_and_commit(func, q):
import os import sys import gzip from argparse import ArgumentParser from config import to_envvar # Create argument parser parser = ArgumentParser(description='Generate concatenated and minified CSS and JS assets.') parser.add_argument('conf_path', nargs='?', metavar='config.ini', help='path to the configuration INI file') # Parse arguments args = parser.parse_args() # Load config from file if not to_envvar(args.conf_path): parser.error('Config file "{}" not found.'.format(args.conf_path)) # Create assets environment from skylines import app app.add_assets() # Generate the assets/bundles for bundle in app.assets: print 'Generating bundle: {}'.format(bundle.output) bundle.build() # Generate GZipped bundles for nginx static gzip serving bundle_path = bundle.resolve_output() compressed_path = bundle_path + '.gz' print 'Compressing bundle: {} -> {}'.format(os.path.basename(bundle_path),
#!/usr/bin/env python # # A interactive shell for inspecting the SkyLines data model. # import sys import os from config import to_envvar sys.path.append(os.path.dirname(sys.argv[0])) conf_path = len(sys.argv) > 1 and sys.argv[1] if not to_envvar(conf_path): sys.exit('Config file "{}" not found.'.format(conf_path)) from IPython.config.loader import Config from IPython.frontend.terminal.embed import InteractiveShellEmbed from skylines import app from skylines.model import * config = Config() shell = InteractiveShellEmbed(config=config) shell.push(globals()) shell('SkyLines Shell')
def _create_app(config): if not to_envvar(config): print 'Config file "{}" not found.'.format(config) sys.exit(1) return create_app()
import config config.to_envvar() from skylines import create_combined_app application = create_combined_app()