Esempio n. 1
0
 def test_reads_from_environment_if_set(self):
     result = env.get(self.key, 'qwerty', DEV='dvorak')
     self.assertEqual(result, 'qwerty')
     os.environ['ENVIRONMENT'] = 'DEV'
     result = env.get(self.key, 'qwerty', DEV='dvorak')
     self.assertEqual(result, 'dvorak')
     del os.environ['ENVIRONMENT']  # teardown
Esempio n. 2
0
 def test_no_default_unless_in_environment(self):
     result = env.get(self.key, DEV='dvorak')
     self.assertEqual(result, '')
     os.environ['ENVIRONMENT'] = 'DEV'
     result = env.get(self.key, DEV='dvorak')
     self.assertEqual(result, 'dvorak')
     del os.environ['ENVIRONMENT']  # teardown
 def test_no_default_unless_in_environment_and_bool(self):
     result = env.get(self.key, DEV=False)
     self.assertEqual(result, '')
     os.environ['ENVIRONMENT'] = 'DEV'
     result = env.get(self.key, DEV=False)
     self.assertEqual(result, False)
     del os.environ['ENVIRONMENT']  # teardown
Esempio n. 4
0
 def test_no_default_unless_in_environment_and_bool(self):
     result = env.get(self.key, DEV=False)
     self.assertEqual(result, '')
     os.environ['ENVIRONMENT'] = 'DEV'
     result = env.get(self.key, DEV=False)
     self.assertEqual(result, False)
     del os.environ['ENVIRONMENT']  # teardown
 def test_reads_from_environment_if_set(self):
     result = env.get(self.key, 'qwerty', DEV='dvorak')
     self.assertEqual(result, 'qwerty')
     os.environ['ENVIRONMENT'] = 'DEV'
     result = env.get(self.key, 'qwerty', DEV='dvorak')
     self.assertEqual(result, 'dvorak')
     del os.environ['ENVIRONMENT']  # teardown
 def test_no_default_unless_in_environment(self):
     result = env.get(self.key, DEV='dvorak')
     self.assertEqual(result, '')
     os.environ['ENVIRONMENT'] = 'DEV'
     result = env.get(self.key, DEV='dvorak')
     self.assertEqual(result, 'dvorak')
     del os.environ['ENVIRONMENT']  # teardown
Esempio n. 7
0
def send_tweet(text):
    auth = tweepy.OAuthHandler(
        env.get('CONSUMER_KEY'), env.get('CONSUMER_SECRET'))
    auth.set_access_token(
        env.get('ACCESS_KEY'), env.get('ACCESS_SECRET'))
    api = tweepy.API(auth)
    api.update_status(text)
    logger.info(u'Sent: {} ({})'.format(text.encode('ascii', errors='ignore'), len(text)))
Esempio n. 8
0
def upload_thumb(document, thumbnail):
    """
    Upload the thumbnail for the document.

    Returns the path (key name).
    """
    s3_key = '/thumbs/{}.jpg'.format(document.edims_id)
    conn = S3Connection(
        aws_access_key_id=env.get('AWS_ACCESS_KEY_ID'),
        aws_secret_access_key=env.get('AWS_SECRET_ACCESS_KEY'),
        host=env.get('AWS_S3_HOST'),
        calling_format=boto.s3.connection.OrdinaryCallingFormat(),
    )
    bucket = conn.get_bucket(env.get('AWS_BUCKET'))
    k = bucket.new_key(s3_key)
    k.set_contents_from_string(
        thumbnail,
        headers={
            'Content-Type': 'image/jpeg',
            'Cache-Control': 'public,max-age=15552000',  # 180 days
        },
    )
    k.set_canned_acl('public-read')
    return s3_key
 def test_reads_from_default(self):
     result = env.get(self.key, 'qwerty')
     self.assertEqual(result, 'qwerty')
Esempio n. 10
0
 def test_gets_value(self):
     self.set_val('foobar')
     result = env.get(self.key)
     self.assertEqual(result, 'foobar')
Esempio n. 11
0
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(__file__)

import dj_database_url
from project_runpy import env

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env.get('SECRET_KEY', 'Rotom')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env.get('DEBUG', False)

ALLOWED_HOSTS = ['*']

# Application definition

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'taggit',
    'tasteinsight.apps.backend',

    # support
    'django_extensions',
)
Esempio n. 12
0
https://docs.djangoproject.com/en/dev/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os

BASE_DIR = os.path.dirname(__file__)

import dj_database_url
from project_runpy import env

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env.get("SECRET_KEY", "Rotom")

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env.get("DEBUG", False)

ALLOWED_HOSTS = ["*"]  # Reverse proxy handles host matching for us


# Application definition

INSTALLED_APPS = [
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
Esempio n. 13
0
# Django settings for example_project project.
import os

import dj_database_url
from project_runpy import env

def project_dir(*paths):
    base = os.path.realpath(os.path.dirname(__file__))
    return os.path.join(base, *paths)


# default to DEBUG=True
DEBUG = env.get('DEBUG', False)
TEMPLATE_DEBUG = DEBUG

ADMINS = (
    # ('Your Name', '*****@*****.**'),
)

MANAGERS = ADMINS

DATABASES = {'default': dj_database_url.config(default='sqlite:///' +
    project_dir('example_project.sqlite'))}

# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ['*']

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
Esempio n. 14
0
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))

from project_runpy import env


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/

SECRET_KEY = env.get('SECRET_KEY', '123456')

DEBUG = env.get('DEBUG', False)

ALLOWED_HOSTS = ['*']

ROOT_URLCONF = 'echo.urls'

TEMPLATE_DIRS = (
    os.path.join(BASE_DIR, 'echo'),
)

INSTALLED_APPS = []

MIDDLEWARE_CLASSES = []
Esempio n. 15
0
# Django settings for example_project project.
import os

import dj_database_url
from project_runpy import env


def project_dir(*paths):
    base = os.path.realpath(os.path.dirname(__file__))
    return os.path.join(base, *paths)


# default to DEBUG=True
DEBUG = env.get('DEBUG', True)
TEMPLATE_DEBUG = DEBUG

ADMINS = (
    # ('Your Name', '*****@*****.**'),
)

MANAGERS = ADMINS

# List of internal IPs
INTERNAL_IPS = ('127.0.0.1', '10.0.2.2', )

DATABASES = {'default': dj_database_url.config(default='sqlite:///' +
    project_dir('example_project.sqlite'))}

# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ['*']
Esempio n. 16
0
 def test_gets_value(self):
     self.set_val('foobar')
     result = env.get(self.key)
     self.assertEqual(result, 'foobar')
Esempio n. 17
0
        self.ws = ws

        async for msg in ws:
            try:
                in_data = json.loads(msg.data)
            except TypeError as e:
                self.send({'error': 'Invalid message {}'.format(e)})

            if 'context' in in_data:
                self.process_context(in_data['context'].strip())

            if 'jinja2' in in_data:
                self.j2_template = in_data['jinja2']

            self.render_to_user()
        return ws


if __name__ == '__main__':
    app = web.Application()
    aiohttp_jinja2.setup(app, loader=jinja2.FileSystemLoader('public'))

    app.router.add_route('GET', '/', index)  # TODO try and see if add_static will work
    app.router.add_route('GET', '/ws', WebSocketHandler)
    app.router.add_static('/static', 'assets')

    web.run_app(
        app,
        port=env.get('PORT', 8080),
    )
Esempio n. 18
0
https://docs.djangoproject.com/en/dev/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))

import dj_database_url
from project_runpy import env


# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env.get('SECRET_KEY', 'Rotom')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

TEMPLATE_DEBUG = True

ALLOWED_HOSTS = ['*']  # TODO


# Application definition

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
Esempio n. 19
0
            store.add(save_path, meta)
        if len(data) < 100:
            # don't need to check next page
            break
        offset += 100
    store.save()


logger = logging.getLogger('downloader')
# hack to keep from adding handler multiple times
if not len(logger.handlers):
    logger.setLevel(logging.DEBUG)
    logger.addHandler(ColorizingStreamHandler())

if __name__ == "__main__":
    arguments = docopt(__doc__)
    download_base = arguments['<directory>']
    username = arguments['--username'] or env.get('ZOOTOOL_USERNAME')
    api_key = arguments['--key'] or env.get('ZOOTOOL_API_KEY')
    cwd = os.getcwd()
    try:
        if not os.path.isdir(download_base):
            os.mkdir(download_base)
        os.chdir(download_base)
        store = Store()
        main(username)
    except:
        raise
    finally:
        os.chdir(cwd)
Esempio n. 20
0
https://docs.djangoproject.com/en/1.6/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))


from project_runpy import env
import dj_database_url


ENVIRONMENT = env.get('ENVIRONMENT')

SECRET_KEY = env.get('SECRET_KEY', '12345')

DEBUG = env.get('DEBUG', False)

TEMPLATE_DEBUG = DEBUG

ALLOWED_HOSTS = ['*']  # XXX

SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')


# Application definition

INSTALLED_APPS = [
Esempio n. 21
0
# Django settings for example_project project.
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))

import dj_database_url
from project_runpy import env

DEBUG = env.get('DEBUG', True)
TEMPLATE_DEBUG = DEBUG

ALLOWED_HOSTS = ['*']  # XXX

environment = env.get('ENVIRONMENT')

_database_url = env.get('DATABASE_URL', 'postgis:///tx_lobbying')
if environment == 'test':
    MIGRATION_MODULES = {'tx_lobbying': 'tx_lobbying.migraintions'}
DATABASES = {'default': dj_database_url.parse(_database_url)}

##
# PostGIS
#
# This setting prevents Django from selecting `postgis_version()` every
# request to determine the feature level supported by PostGIS.
#
# Note: Travis CI currently uses 2.1.0
# http://docs.travis-ci.com/user/using-postgresql/
POSTGIS_VERSION = (2, 1, 0)

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
Esempio n. 22
0
            'filename': 'import.log',
            'formatter': 'verbose'
        },
        'console': {
            'level': 'DEBUG',
            'class': 'project_runpy.ColorizingStreamHandler',
        },
    },
    'loggers': {
        'django': {
            'handlers':['file'],
            'propagate': True,
            'level':'ERROR',
        },
        'django.db.backends': {
            'level': 'DEBUG' if env.get('SQL') else 'INFO',
            'handlers': ['console'],
            'filters': ['require_debug_true', 'readable_sql'],
            'propagate': False,
        },
        'cockpit.utils': {
            'handlers': ['file'],
            'level': 'DEBUG',
        },
    }
}

import logging.config
logging.config.dictConfig(LOGGING)

Esempio n. 23
0
 def test_get_bool_coerced_version_false(self):
     self.set_val('0')
     result = env.get(self.key, 'True', type_func=bool)
     self.assertIs(result, False)
Esempio n. 24
0
 def test_false_gives_false(self):
     self.set_val('fAlsE')
     result = env.get(self.key, True)
     self.assertIs(result, False)
Esempio n. 25
0
 def test_geting_empty_is_null_string(self):
     result = env.get(self.key)
     self.assertIs(result, '')
Esempio n. 26
0
            'filename': 'import.log',
            'formatter': 'verbose'
        },
        'console': {
            'level': 'DEBUG',
            'class': 'project_runpy.ColorizingStreamHandler',
        },
    },
    'loggers': {
        'django': {
            'handlers': ['file'],
            'propagate': True,
            'level': 'ERROR',
        },
        'django.db.backends': {
            'level': 'DEBUG' if env.get('SQL') else 'INFO',
            'handlers': ['console'],
            'filters': ['require_debug_true', 'readable_sql'],
            'propagate': False,
        },
        'cockpit.utils': {
            'handlers': ['file'],
            'level': 'DEBUG',
        },
    }
}

import logging.config
logging.config.dictConfig(LOGGING)

LANGUAGE_CODE = 'en-us'
Esempio n. 27
0
 def test_reads_from_default(self):
     result = env.get(self.key, 'qwerty')
     self.assertEqual(result, 'qwerty')
Esempio n. 28
0
import os

import dj_database_url
from project_runpy import env

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


SECRET_KEY = os.getenv('SECRET_KEY', 'n9y25ah7')

DEBUG = env.get('DEBUG', False)
INTERNAL_IPS = ['127.0.0.1']
ALLOWED_HOSTS = ['*']  # Handled in Nginx


# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.humanize',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django_extensions',
    'django_cool_paginator',
    'social_django',

    'apps.tracker',
Esempio n. 29
0
 def test_gets_as_bool_if_default_is_bool(self):
     self.set_val('1')
     result = env.get(self.key, True)
     self.assertIs(result, True)
Esempio n. 30
0
from amazon.api import AmazonAPI
from project_runpy import env


AMAZON_ASSOC_TAG = env.get('AMAZON_ASSOC_TAG')
AMAZON_SECRET_KEY = env.get('AMAZON_SECRET_KEY')
AMAZON_ACCESS_KEY = env.get('AMAZON_ACCESS_KEY')


def get_api():
    return AmazonAPI(AMAZON_ACCESS_KEY, AMAZON_SECRET_KEY, AMAZON_ASSOC_TAG)


def lookup(query):
    """
    Find a product on amazon.

    SearchIndex are: 'All', 'Apparel', 'Appliances', 'ArtsAndCrafts',
    'Automotive', 'Baby', 'Beauty', 'Blended', 'Books', 'Classical',
    'Collectibles', 'DVD', 'DigitalM usic', 'Electronics', 'GiftCards',
    'GourmetFood', 'Grocery', 'HealthPersonalCare', 'HomeGarden', 'Industrial',
    'Jewelry', 'KindleStore', 'Kitchen', 'LawnAndGarde n', 'Marketplace',
    'MP3Downloads', 'Magazines', 'Miscellaneous', 'Music', 'MusicTracks',
    'MusicalInstruments', 'MobileApps', 'OfficeProducts', 'OutdoorLiving',
    'PCHardware', 'PetSupplies', 'Photo', 'Shoes', 'Software', 'SportingGoods',
    'Tools', 'Toys', 'UnboxVideo', 'VHS', 'Video', 'VideoGames', 'Watches',
    'Wireless', 'WirelessAccessories'

    Keywords that can be used:
    http://docs.aws.amazon.com/AWSECommerceService/latest/DG/USSearchIndexParamForItemsearch.html
    """
Esempio n. 31
0
 def test_get_bool_coerced_version_false(self):
     self.set_val('0')
     result = env.get(self.key, 'True', type_func=bool)
     self.assertIs(result, False)
Esempio n. 32
0
# Django settings for example_project project.
import os

BASE_DIR = os.path.dirname(os.path.dirname(__file__))

import dj_database_url
from project_runpy import env


DEBUG = env.get("DEBUG", True)
TEMPLATE_DEBUG = DEBUG

ALLOWED_HOSTS = ["*"]  # XXX

environment = env.get("ENVIRONMENT")

if environment == "test":
    # https://github.com/henriquebastos/django-test-without-migrations
    class DisableMigrations(object):
        def __contains__(self, item):
            return True

        def __getitem__(self, item):
            return "notmigrations"

    MIGRATION_MODULES = DisableMigrations()
DATABASES = {"default": dj_database_url.config()}

##
# PostGIS
#
Esempio n. 33
0
 def test_coerced_bool_no_default_no_value_is_true(self):
     result = env.get(self.key, type_func=bool)
     self.assertIs(result, True)
Esempio n. 34
0
import os

from project_runpy import env
import dj_database_url


# From armstrong.cli. This function will eventually be in an armstrong
# utils package, at which point we should stop duplicating it here.
def project_dir(*paths):
    base = os.path.realpath(os.path.join(os.path.dirname(__file__), '..'))
    return os.path.join(base, *paths)

DEBUG = env.get('DEBUG', True)  # example project, so assume you're debugging
TEMPLATE_DEBUG = DEBUG

ADMINS = (
    # ('Your Name', '*****@*****.**'),
)

MANAGERS = ADMINS

DATABASES = {'default': dj_database_url.config(default='postgis:///tx_highered')}
DATABASES['default']['OPTIONS'] = {'autocommit': True}

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
Esempio n. 35
0
 def test_false_gives_false(self):
     self.set_val('fAlsE')
     result = env.get(self.key, True)
     self.assertIs(result, False)
Esempio n. 36
0
 def test_geting_empty_is_null_string(self):
     result = env.get(self.key)
     self.assertIs(result, '')
Esempio n. 37
0
 def test_can_coerce_to_other_types(self):
     self.set_val('20')
     result = env.get(self.key, 10)
     self.assertIs(result, 20)
Esempio n. 38
0
 def test_gets_as_bool_if_default_is_bool(self):
     self.set_val('1')
     result = env.get(self.key, True)
     self.assertIs(result, True)
Esempio n. 39
0
# Django settings for example_project project.
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))

import dj_database_url
from project_runpy import env

DEBUG = env.get('DEBUG', True)
TEMPLATE_DEBUG = DEBUG

ALLOWED_HOSTS = ['*']  # XXX

environment = env.get('ENVIRONMENT')

if environment == 'test':
    # https://github.com/henriquebastos/django-test-without-migrations
    class DisableMigrations(object):
        def __contains__(self, item):
            return True

        def __getitem__(self, item):
            return "notmigrations"

    MIGRATION_MODULES = DisableMigrations()
DATABASES = {'default': dj_database_url.config()}

##
# PostGIS
#
# This setting prevents Django from selecting `postgis_version()` every
# request to determine the feature level supported by PostGIS.
Esempio n. 40
0
 def test_coerced_bool_no_default_no_value_is_true(self):
     result = env.get(self.key, type_func=bool)
     self.assertIs(result, True)
Esempio n. 41
0
# Refresh a database from another one

# Does the following:
# - deletes the target database
# - restores the most recent snapshot of the source db as the target db
# - removes the snapshot

# Requires:
# - boto
# - AWS credentials
# - project_runpy
# - Delorean

target_db = env.require('TARGET_DB')
source_db = env.require('SOURCE_DB')
db_subnet_group = env.get('DB_SUBNET_GROUP')
security_group = env.require('SECURITY_GROUP')
target_pass = env.require('TARGET_PASS')

region = env.get('AWS_REGION', 'us-east-1')
instance_class = env.get('INSTANCE_CLASS', 'db.t1.micro')

if 'prod' in target_db:
    exit("that looks like production; do it yourself")

rds_connection = boto.rds.connect_to_region(region)

# print "deleting {} snapshot...".format(snapshot)
# try:
#    rds_connection.delete_dbsnapshot(snapshot)
# except BotoServerError as e:
Esempio n. 42
0
 def test_can_coerce_to_other_types(self):
     self.set_val('20')
     result = env.get(self.key, 10)
     self.assertIs(result, 20)
Esempio n. 43
0
# Django settings for example_project project.
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))

import dj_database_url
from project_runpy import env


DEBUG = env.get('DEBUG', True)
TEMPLATE_DEBUG = DEBUG

ALLOWED_HOSTS = ['*']  # XXX

environment = env.get('ENVIRONMENT')

_database_url = env.get('DATABASE_URL', 'postgis:///tx_lobbying')
if environment == 'test':
    MIGRATION_MODULES = {
        'tx_lobbying': 'tx_lobbying.migraintions'
    }
DATABASES = {'default': dj_database_url.parse(_database_url)}

##
# PostGIS
#
# This setting prevents Django from selecting `postgis_version()` every
# request to determine the feature level supported by PostGIS.
#
# Note: Travis CI currently uses 2.1.0
# http://docs.travis-ci.com/user/using-postgresql/
POSTGIS_VERSION = (2, 1, 0)
Esempio n. 44
0
# Django settings for example_project project.
import os
BASE_DIR = os.path.dirname(__file__)

import dj_database_url
from project_runpy import env


# current choices: 'prod', 'test'
ENVIRONMENT = env.get('ENVIRONMENT', 'prod')


# default to DEBUG=True
DEBUG = env.get('DEBUG', False)
TEMPLATE_DEBUG = DEBUG

ADMINS = (
    # ('Your Name', '*****@*****.**'),
)

MANAGERS = ADMINS

DATABASES = {'default': dj_database_url.config(default='sqlite:///' +
    os.path.join(BASE_DIR, 'example_project.db'))}

# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ['*']

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
Esempio n. 45
0
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(__file__)

import dj_database_url
# import raven
from project_runpy import env

SECRET_KEY = env.get('SECRET_KEY', 'Rotom')
DEBUG = env.get('DEBUG', False)

ALLOWED_HOSTS = ['*']


# Application definition

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    'bandc.apps.agenda',

    # support
    'djcelery',
    'raven.contrib.django.raven_compat',
    'django_extensions',
    'django_object_actions',
Esempio n. 46
0
import urlparse

from project_runpy import env


DEBUG = True

SECRET_KEY = env.get('SECRET_KEY')


# DATABASE
urlparse.uses_netloc.append('postgresql')
url = urlparse.urlparse(env.get('DATABASE_URL'))
DATABASE = {
    'database': url.path[1:],
    'user': url.username,
    'password': url.password,
    'host': url.hostname,
    'port': url.port,
}

# OAuth
# https://github.com/lepture/flask-oauthlib/blob/master/example/google.py
GOOGLE_ID = env.get('GOOGLE_ID')
GOOGLE_SECRET = env.get('GOOGLE_SECRET')

if env.get('ENVIRONMENT') == 'test':
    # disable error catching during request handling for better error reports
    TESTING = True
    WTF_CSRF_ENABLED = False
    DATABASE['database'] += '_test'
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os

BASE_DIR = os.path.dirname(__file__)

import dj_database_url
from project_runpy import env


SECRET_KEY = env.get("SECRET_KEY", "Rotom")
DEBUG = env.get("DEBUG", False)

ALLOWED_HOSTS = ["*"]


# Application definition

INSTALLED_APPS = (
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    # support
    "django_extensions",
)

MIDDLEWARE_CLASSES = (
    "django.contrib.sessions.middleware.SessionMiddleware",
    "django.middleware.common.CommonMiddleware",
Esempio n. 48
0
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(__file__)

import dj_database_url
from project_runpy import env


# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env.get('SECRET_KEY', 'Rotom')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env.get('DEBUG', False)

ALLOWED_HOSTS = ['*']


# Application definition

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'taggit',
    'tasteinsight.apps.backend',

    # support
Esempio n. 49
0
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(__file__)

import dj_database_url
from project_runpy import env


SECRET_KEY = env.get('SECRET_KEY', 'Rotom')

DEBUG = env.get('DEBUG', False)
TEMPLATE_DEBUG = True

ALLOWED_HOSTS = ['*']  # TODO


# Application definition

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    # app
    'ipeds_reporter',

    # support
    'django_extensions',