def app(request, session_config): app = create_app( _read_config=False, TESTING=True, SQLALCHEMY_DATABASE_URI='postgresql:///' + session_config['db_name'], REDIS_URL='redis://localhost/' + session_config['redis_db'], BASE_URI='http://example.com', REPO_ROOT='/tmp', GREEN_BUILD_URL='https://foo.example.com', GREEN_BUILD_AUTH=('username', 'password'), JENKINS_URL='http://jenkins.example.com', PHABRICATOR_LINK_HOST='http://phabricator.example.com', PHABRICATOR_API_HOST='http://phabricator.example.com', GOOGLE_CLIENT_ID='a' * 12, GOOGLE_CLIENT_SECRET='b' * 40, DEFAULT_FILE_STORAGE='changes.storage.mock.FileStorageCache', LXC_PRE_LAUNCH='echo pre', LXC_POST_LAUNCH='echo post', SNAPSHOT_S3_BUCKET='snapshot-bucket' ) app_context = app.test_request_context() context = app_context.push() # request.addfinalizer(app_context.pop) return app
def app(request, session_config): app = create_app( _read_config=False, TESTING=True, SQLALCHEMY_DATABASE_URI='postgresql:///' + session_config['db_name'], REDIS_URL='redis://localhost/' + session_config['redis_db'], BASE_URI='http://example.com', REPO_ROOT='/tmp', GREEN_BUILD_URL='https://foo.example.com', GREEN_BUILD_AUTH=('username', 'password'), JENKINS_URL='http://jenkins.example.com', JENKINS_SYNC_LOG_ARTIFACTS=True, PHABRICATOR_HOST='http://phabricator.example.com', GOOGLE_CLIENT_ID='a' * 12, GOOGLE_CLIENT_SECRET='b' * 40, HIPCHAT_TOKEN='abc', DEFAULT_FILE_STORAGE='changes.storage.mock.FileStorageCache', LXC_PRE_LAUNCH='echo pre', LXC_POST_LAUNCH='echo post', SNAPSHOT_S3_BUCKET='snapshot-bucket' ) app_context = app.test_request_context() context = app_context.push() # request.addfinalizer(app_context.pop) return app
def app(request): app = create_app( _read_config=False, TESTING=True, SQLALCHEMY_DATABASE_URI='postgresql:///test_changes', REDIS_URL='redis://localhost/9', BASE_URI='http://example.com', REPO_ROOT='/tmp', JENKINS_URL='http://jenkins.example.com', JENKINS_SYNC_LOG_ARTIFACTS=True, GOOGLE_CLIENT_ID='a' * 12, GOOGLE_CLIENT_SECRET='b' * 40, HIPCHAT_TOKEN='abc', ) app_context = app.test_request_context() app_context.push() return app
def app(request): app = create_app( _read_config=False, TESTING=True, SQLALCHEMY_DATABASE_URI='postgresql:///test_changes', REDIS_URL='redis://localhost/9', BASE_URI='http://example.com', REPO_ROOT='/tmp', GREEN_BUILD_URL='https://foo.example.com', GREEN_BUILD_AUTH=('username', 'password'), JENKINS_URL='http://jenkins.example.com', JENKINS_SYNC_LOG_ARTIFACTS=True, GOOGLE_CLIENT_ID='a' * 12, GOOGLE_CLIENT_SECRET='b' * 40, HIPCHAT_TOKEN='abc', ) app_context = app.test_request_context() app_context.push() return app
def app(request, session_config): app = create_app( _read_config=False, TESTING=True, SQLALCHEMY_DATABASE_URI='postgresql:///' + session_config['db_name'], REDIS_URL='redis://localhost/' + session_config['redis_db'], BASE_URI='http://example.com', REPO_ROOT='/tmp', GREEN_BUILD_URL='https://foo.example.com', GREEN_BUILD_AUTH=('username', 'password'), JENKINS_URL='http://jenkins.example.com', JENKINS_SYNC_LOG_ARTIFACTS=True, GOOGLE_CLIENT_ID='a' * 12, GOOGLE_CLIENT_SECRET='b' * 40, HIPCHAT_TOKEN='abc', ) app_context = app.test_request_context() context = app_context.push() # request.addfinalizer(app_context.pop) return app
def app(request, session_config): app = create_app( _read_config=False, TESTING=True, SQLALCHEMY_DATABASE_URI='postgresql:///' + session_config['db_name'], REDIS_URL='redis://localhost/' + session_config['redis_db'], BASE_URI='http://example.com', REPO_ROOT='/tmp', GREEN_BUILD_URL='https://foo.example.com', GREEN_BUILD_AUTH=('username', 'password'), JENKINS_URL='http://jenkins.example.com', JENKINS_SYNC_LOG_ARTIFACTS=True, GOOGLE_CLIENT_ID='a' * 12, GOOGLE_CLIENT_SECRET='b' * 40, HIPCHAT_TOKEN='abc', DEFAULT_FILE_STORAGE='changes.storage.dummy.DummyFileStorage', ) app_context = app.test_request_context() context = app_context.push() # request.addfinalizer(app_context.pop) return app
"""Sets up webassets environment so that static bundles can be pre-built. Changes by default, generates bundled css files on the first request using flask-assets. The webassets CLI allows them to be generated manually beforehand. This module is required by the webassets CLI for building web assets. Example usage: `env/bin/webassets -m changes.webassets_env build` These bundle definitions are gotten from webapp/html/webapp.html. """ from flask_assets import Bundle from changes.config import create_app, configure_assets app = create_app() environment = configure_assets(app) environment.register( "css", Bundle("css/bundle_definition.less", filters="less", output="dist/bundled.css", depends=["**/*.less", "css/bundle_definition.less"])) environment.register( "colorblind_css", Bundle("css/bundle_definition_colorblind.less", filters="less", output="dist/bundled_colorblind.css", depends=["**/*.less", "css/bundle_definition_colorblind.less"])) if app.config['WEBAPP_CUSTOM_CSS']: environment.register( "css_custom",
#!/usr/bin/env python from gevent import monkey monkey.patch_all() from changes.db import psyco_gevent psyco_gevent.make_psycopg_green() from flask.ext.actions import Manager from changes.config import create_app app = create_app(gevent=True) ctx = app.app_context() ctx.__enter__() manager = Manager(app) if __name__ == "__main__": manager.run()
from changes.db.types.json import JSONEncodedDict sa.Enum = Enum sa.GUID = GUID sa.JSONEncodedDict = JSONEncodedDict # add your model's MetaData object here # for 'autogenerate' support from flask import current_app from changes.config import create_app, db import warnings from sqlalchemy.exc import SAWarning warnings.simplefilter("ignore", SAWarning) if not current_app: app = create_app() else: app = current_app app.app_context().push() target_metadata = db.metadata # force registration of models import changes.models # NOQA def run_migrations(): """Run migrations in 'online' mode. In this scenario we need to create an Engine and associate a connection with the context.
""" This file acts as a default entry point for app creation. """ from changes.config import create_app, queue import sys # command line parameter allows us to run changes with a profiler # easier than maintaining two separate app configs profiler_directory = None for idx, arg in enumerate(sys.argv): if arg == "--run-profiler" and len(sys.argv) > idx + 1: profiler_directory = sys.argv[idx + 1] break app = create_app(profiler_directory=profiler_directory) # HACK(dcramer): this allows Celery to detect itself -.- celery = queue.celery