Example #1
0
 def test_env_var(self):
     value = Value('default')
     self.assertEqual(value.setup('TEST'), 'override')
     self.assertEqual(str(value), 'override')
     self.assertNotEqual(value.setup('TEST'), value.default)
     self.assertEqual(value.to_python(os.environ['DJANGO_TEST']),
                      value.setup('TEST'))
    def test_env_var_prefix(self):
        with patch.dict(os.environ, clear=True, ACME_TEST='override'):
            value = Value('default', environ_prefix='ACME')
            self.assertEqual(value.setup('TEST'), 'override')

        with patch.dict(os.environ, clear=True, TEST='override'):
            value = Value('default', environ_prefix='')
            self.assertEqual(value.setup('TEST'), 'override')
Example #3
0
 def test_value_reuse(self):
     value1 = Value('default')
     value2 = Value(value1)
     self.assertEqual(value1.setup('TEST1'), 'default')
     self.assertEqual(value2.setup('TEST2'), 'default')
     with env(DJANGO_TEST1='override1', DJANGO_TEST2='override2'):
         self.assertEqual(value1.setup('TEST1'), 'override1')
         self.assertEqual(value2.setup('TEST2'), 'override2')
Example #4
0
    def test_env_var_prefix(self):
        with patch.dict(os.environ, clear=True, ACME_TEST='override'):
            value = Value('default', environ_prefix='ACME')
            self.assertEqual(value.setup('TEST'), 'override')

        with patch.dict(os.environ, clear=True, TEST='override'):
            value = Value('default', environ_prefix='')
            self.assertEqual(value.setup('TEST'), 'override')

        with patch.dict(os.environ, clear=True, ACME_TEST='override'):
            value = Value('default', environ_prefix='ACME_')
            self.assertEqual(value.setup('TEST'), 'override')
    def test_value_with_default_and_late_binding(self):
        value = Value("default", environ=False, late_binding=True)
        self.assertEqual(type(value), Value)
        with env(DJANGO_TEST="override"):
            self.assertEqual(value.setup("TEST"), "default")
            value = Value(environ_name="TEST")
            self.assertEqual(type(value), type("override"))
            self.assertEqual(value, "override")
            self.assertEqual(str(value), "override")
            self.assertEqual("{0}".format(value), "override")
            self.assertEqual("%s" % value, "override")

            value = Value(environ_name="TEST", late_binding=True)
            self.assertEqual(type(value), Value)
            self.assertEqual(value.value, "override")
            self.assertEqual(str(value), "override")
            self.assertEqual("{0}".format(value), "override")
            self.assertEqual("%s" % value, "override")

            self.assertEqual(repr(value), repr("override"))
Example #6
0
    def test_value_with_default_and_late_binding(self):
        value = Value('default', environ=False, late_binding=True)
        self.assertEqual(type(value), Value)
        with env(DJANGO_TEST='override'):
            self.assertEqual(value.setup('TEST'), 'default')
            value = Value(environ_name='TEST')
            self.assertEqual(type(value), type('override'))
            self.assertEqual(value, 'override')
            self.assertEqual(str(value), 'override')
            self.assertEqual('{0}'.format(value), 'override')
            self.assertEqual('%s' % value, 'override')

            value = Value(environ_name='TEST', late_binding=True)
            self.assertEqual(type(value), Value)
            self.assertEqual(value.value, 'override')
            self.assertEqual(str(value), 'override')
            self.assertEqual('{0}'.format(value), 'override')
            self.assertEqual('%s' % value, 'override')

            self.assertEqual(repr(value), repr('override'))
Example #7
0
 def test_env_var(self):
     value = Value('default')
     self.assertEqual(value.setup('TEST'), 'override')
     self.assertEqual(str(value), 'override')
     self.assertNotEqual(value.setup('TEST'), value.default)
     self.assertEqual(value.to_python(os.environ['DJANGO_TEST']),
                      value.setup('TEST'))
class DeploymentConfig(object):
    # SECURITY WARNING: keep the secret key used in production secret!
    SECRET_KEY = 'replacethiswithsomethingsecret'

    # SECURITY WARNING: don't run with debug turned on in production!
    # Set this to True while you are developing
    DEBUG = BooleanValue(True)

    POLIS_SITE_ID = Value(None)

    # Unrestricted staging key (disposable)
    GMAPS_API_KEY = Value('AIzaSyDVJdClcbq1ioJUeySpPgNiDndQEspN6Ck')
    # Set this to a "frozen version" in production
    # See: https://developers.google.com/maps/documentation/javascript/versions#the-frozen-version
    GMAPS_API_VERSION = Value('3.exp')

    # See: https://django-configurations.readthedocs.org/en/stable/values/#configurations.values.DatabaseURLValue
    DATABASES = DatabaseURLValue('sqlite:///tor_councilmatic.db')

    # See: https://django-configurations.readthedocs.org/en/stable/values/#configurations.values.SearchURLValue
    # See: https://github.com/dstufft/dj-search-url
    HAYSTACK_CONNECTIONS = SearchURLValue('simple://')

    # See: https://django-configurations.readthedocs.org/en/stable/values/#configurations.values.CacheURLValue
    # See: https://github.com/ghickman/django-cache-url
    CACHES = CacheURLValue('dummy://')

    # Set this to flush the cache at /flush-cache/{FLUSH_KEY}
    FLUSH_KEY = 'super secret junk'

    # Set this to allow Disqus comments to render
    DISQUS_SHORTNAME = None

    # analytics tracking code
    ANALYTICS_TRACKING_CODE = Value('')

    HEADSHOT_PATH = os.path.join(os.path.dirname(__file__), '..'
                                 '/toronto/static/images/')

    EXTRA_APPS = ()
 def test_value_reuse(self):
     value1 = Value("default")
     value2 = Value(value1)
     self.assertEqual(value1.setup("TEST1"), "default")
     self.assertEqual(value2.setup("TEST2"), "default")
     with env(DJANGO_TEST1="override1", DJANGO_TEST2="override2"):
         self.assertEqual(value1.setup("TEST1"), "override1")
         self.assertEqual(value2.setup("TEST2"), "override2")
Example #10
0
 def test_value_reuse(self):
     value1 = Value('default')
     value2 = Value(value1)
     self.assertEqual(value1.setup('TEST1'), 'default')
     self.assertEqual(value2.setup('TEST2'), 'default')
     with env(DJANGO_TEST1='override1', DJANGO_TEST2='override2'):
         self.assertEqual(value1.setup('TEST1'), 'override1')
         self.assertEqual(value2.setup('TEST2'), 'override2')
Example #11
0
    def test_env_var_prefix(self):
        with patch.dict(os.environ, clear=True, ACME_TEST="override"):
            value = Value("default", environ_prefix="ACME")
            self.assertEqual(value.setup("TEST"), "override")

        with patch.dict(os.environ, clear=True, TEST="override"):
            value = Value("default", environ_prefix="")
            self.assertEqual(value.setup("TEST"), "override")

        with patch.dict(os.environ, clear=True, ACME_TEST="override"):
            value = Value("default", environ_prefix="ACME_")
            self.assertEqual(value.setup("TEST"), "override")
Example #12
0
    def test_value_with_default_and_late_binding(self):
        value = Value('default', environ=False, late_binding=True)
        self.assertEqual(type(value), Value)
        with env(DJANGO_TEST='override'):
            self.assertEqual(value.setup('TEST'), 'default')
            value = Value(environ_name='TEST')
            self.assertEqual(type(value), type('override'))
            self.assertEqual(value, 'override')
            self.assertEqual(str(value), 'override')
            self.assertEqual('{0}'.format(value), 'override')
            self.assertEqual('%s' % value, 'override')

            value = Value(environ_name='TEST', late_binding=True)
            self.assertEqual(type(value), Value)
            self.assertEqual(value.value, 'override')
            self.assertEqual(str(value), 'override')
            self.assertEqual('{0}'.format(value), 'override')
            self.assertEqual('%s' % value, 'override')

            self.assertEqual(repr(value), repr('override'))
class JurisdictionConfig(object):
    ###############################
    # These settings are required #
    ###############################

    OCD_CITY_COUNCIL_NAME = Value('Toronto City Council')
    CITY_COUNCIL_NAME = Value('Toronto City Council')
    OCD_JURISDICTION_ID = Value(
        'ocd-jurisdiction/country:ca/csd:3520005/legislature')
    LEGISLATIVE_SESSIONS = ListValue(
        None
    )  # the last one in this list should be the current legislative session
    CITY_NAME = Value('Toronto')
    CITY_NAME_SHORT = Value(None)

    # TODO: Yuck.
    # See: https://github.com/jazzband/django-configurations/issues/149
    @classmethod
    def setup(cls):
        default_city_short = cls.CITY_NAME_SHORT.value
        super().setup()
        if default_city_short == cls.CITY_NAME_SHORT:
            cls.CITY_NAME_SHORT = cls.CITY_NAME

    city_vocab = {
        'MUNICIPAL_DISTRICT': 'Ward',
        'SOURCE': 'City of Toronto',
        'COUNCIL_MEMBER': 'Councillor',
        'COUNCIL_MEMBERS': 'Councillors',
        'EVENTS': 'Meetings',
    }

    BOUNDARY_API_BASE_URL = Value('http://represent.opennorth.ca')

    # TODO: Keep track of this issue
    # Ref: https://github.com/jazzband/django-configurations/issues/151
    CITY_VOCAB = DictValue(city_vocab)

    APP_NAME = 'toronto'

    #########################
    # The rest are optional #
    #########################

    # this is for populating meta tags
    if os.environ.get('HEROKU_APP_NAME'):
        # Available when labs feature has been turned on: `heroku labs:enable runtime-dyno-metadata`
        # See: https://devcenter.heroku.com/articles/dyno-metadata
        HEROKU_URL = 'https://{}.herokuapp.com'.format(
            os.environ['HEROKU_APP_NAME'])
    else:
        HEROKU_URL = None

    SITE_URL = URLValue(HEROKU_URL or 'https://chicago.councilmatic.org')

    SITE_META = {
        'site_name': 'Toronto Councilmatic',
        'site_desc':
        'City Council, demystified. Keep tabs on Toronto legislation, councillors, & meetings.',
        'site_author': 'Civic Tech Toronto',
        'twitter_site': '@councilmatic',
        'twitter_creator': '@CivicTechTO',
    }

    LEGISTAR_URL = 'https://chicago.legistar.com/Legislation.aspx'

    # this is for the boundaries of municipal districts, to add
    # shapes to posts & ultimately display a map with the council
    # member listing. the boundary set should be the relevant
    # slug from the ocd api's boundary service
    # available boundary sets here: http://ocd.datamade.us/boundary-sets/
    BOUNDARY_SET = Value('toronto-wards')

    # this is for configuring a map of council districts using data from the posts
    # set MAP_CONFIG = None to hide map
    map_config = {
        'center': [43.7245, -79.3882],
        'zoom': 10,
        'color': "#54afe8",
        'highlight_color': "#C00000",
    }

    MAP_CONFIG = DictValue(map_config)

    FOOTER_CREDITS = [
        {
            'name': 'Civic Tech Toronto',
            'url': 'http://civictech.ca/',
            'image': 'civictechto-logo.png',
        },
        {
            'name': 'DataMade',
            'url': 'http://datamade.us/',
            'image': 'datamade-logo.png',
        },
        {
            'name': 'Sunlight Foundation',
            'url': 'http://sunlightfoundation.org/',
            'image': 'sunlight-logo.png',
        },
    ]

    # this is the default text in search bars
    SEARCH_PLACEHOLDER_TEXT = "police, zoning, O2015-7825, etc."

    # these should live in APP_NAME/static/
    IMAGES = {
        'logo': 'images/metro-toronto-logo.png',
    }
    # you can generate icons from the logo at http://www.favicomatic.com/
    # & put them in APP_NAME/static/images/icons/

    # THE FOLLOWING ARE VOCAB SETTINGS RELEVANT TO DATA MODELS, LOGIC
    # (this is diff from VOCAB above, which is all for the front end)

    # this is the name of the meetings where the entire city council meets
    # as stored in legistar
    CITY_COUNCIL_MEETING_NAME = 'City Council'

    COMMITTEE_CHAIR_TITLES = ListValue(['Chair', 'Vice Chair'])

    # this is for convenience, & used to populate a table
    # describing legislation types on the about page template
    LEGISLATION_TYPE_DESCRIPTIONS = [
        {
            'name':
            'Action Items',
            'search_term':
            'Action',
            'fa_icon':
            'check-square-o',
            'html_desc':
            True,
            'desc':
            "Generally, these items are seeking some kind of direction or resolution from Council or Committee. Usually there are proposed recommendations which Council or Committee can adopt or amend by vote.",
        },
        {
            'name':
            'Information Reports',
            'search_term':
            'Information',
            'fa_icon':
            'pie-chart',
            'html_desc':
            True,
            'desc':
            "A City official's report that advises and informs without recommending. <br />A vote is required to dispose of the item (normally, a <em>motion to receive</em>).",
        },
        {
            'name':
            'Presentations',
            'search_term':
            'Presentation',
            'fa_icon':
            'bullhorn',
            'html_desc':
            True,
            'desc':
            "Normally a verbal update, a ceremonial presentation or presentations to the committee without a covering report, such as slide presentations or playing of videos. <br />A vote is required to dispose of the item (normally, a <em>motion to receive</em>).",
        },
    ]

    # these keys should match committee slugs
    # Source: http://www1.toronto.ca/wps/portal/contentonly?vgnextoid=762b6804e1f22410VgnVCM10000071d60f89RCRD&vgnextchannel=9632acb640c21410VgnVCM10000071d60f89RCRD
    COMMITTEE_DESCRIPTIONS = {
        "community-development-and-recreation-committee":
        "Social inclusion and undertaking work to strengthen services to communities and neighbourhoods.",
        "economic-development-committee":
        "Monitors and makes recommendations to strengthen Toronto’s economy and investment climate.",
        "government-management-committee":
        "Government assets and resources; monitors and makes recommendations on the administrative operations of the City.",
        "licensing-and-standards-committee":
        "Consumer safety and protection; monitors and makes recommendations on the licensing of business and the enforcement of property standards.",
        "parks-and-environment-committee":
        "Monitors, makes recommendations and undertakes work to ensure the sustainability of Toronto’s natural environment.",
        "planning-and-growth-management-committee":
        "Urban form and work related to good city planning; monitors and makes recommendations on the planning, growth and development of the City.",
        "public-works-and-infrastructure-committee":
        "Delivers and maintains Toronto’s infrastructure; monitors and makes recommendations on Toronto’s infrastructure needs and services.Urban form and work related to good city planning; monitors and makes recommendations on the planning, growth and development of the City.",
        "executive-committee":
        "Monitors and makes recommendations on Council’s strategic policy and priorities, governance policy and structure, financial planning and budgeting, fiscal policy including revenue and tax policies, intergovernmental and international relations, Council and its operations, and human resources and labour relations.",
        "affordable-housing-committee":
        "Affordable housing policies, acquiring land for affordable housing, providing funding and financing, development fee and charge waivers and property tax reductions or waivers for affordable housing projects. Proposes legislation and advocates to the provincial and federal governments. In charge of strategic planning for Toronto Community Housing, and measuring the effectiveness of Affordable Housing Office projects.",
        "budget-committee":
        "Includes, but is not limited to, coordinating the preparation of the capital and operating estimates, and making recommendations on the capital and operating budgets.",
        "employee-and-labour-relations-committee":
        "Reviews corporate human resource policy issues related to achieving and maintaining excellence in the public service and issues that affect the workforce. Responsibilities include compensation, performance management, training and development, recruitment, retention, retirement, labour relations, human rights, equity goals, wellness, and health and safety strategic policy direction on collective bargaining.",
        "audit-committee":
        "Considers and recommends to Council the appointment of external auditors for the City and the Auditor General’s office; the annual external audits of the financial statements of the City, its agencies and the Auditor General’s office; the Auditor General’s reports, audit plan and accomplishments.",
        "board-of-health":
        "Ensures that Toronto Public Health delivers programs and services in response to local needs; determines and sets public health policy and advises City Council on a broad range of health issues; recommendations with city-wide or financial implications are forwarded to City Council for final approval.",
        "civic-appointments-committee":
        "Considers and recommends to Council the citizens to appoint to agencies.",
        "striking-committee":
        "Recommends councillor appointments to fill the positions of the boards outlined above, as well many other boards, agencies and advisory committees; makes recommendations to Council on the meeting schedule for Council and Council Committees.",
    }

    ABOUT_BLURBS = {
        "COMMITTEES":
        "<p>Most meaningful legislative activity happens in committee meetings, where committee members debate proposed legislation. These meetings are open to the public. Unlike City Council meetings, committee meetings allow for public presentations.<br/><a href='http://www.toronto.ca/legdocs/tmmis/have-your-say.htm' target='_blank'>Find out how »</a></p>\
                        <p>Each committee has a Chair. Along with the City Clerk, the Chair shapes the committee meeting agenda (and thus, the legislation to be considered).</p>\
                        <p>Committee jurisdiction, memberships, and appointments all require City Council approval.</p>",
        "EVENTS":
        "<p>There are two types of meetings: committee meetings and full city council meetings.</p>\
                        <p>Most of the time, meaningful legislative debate happens in committee meetings, which at scheduled at regular intervals depending on the committee.</p>\
                        <p>Meetings of the entire City Council generally occur once a month at City Hall.</p>\
                        <p>All committee and City Council meetings are open to the public.</p>",
        "COUNCIL_MEMBERS": ""
    }

    # notable positions that aren't district representatives, e.g. mayor & city clerk
    # keys should match person slugs
    EXTRA_TITLES = {
        'mendoza-susana-a': 'City Clerk',
        'emanuel-rahm': 'Mayor',
    }

    TOPIC_HIERARCHY = [{
        'name':
        'Citywide matters',
        'children': [
            {
                'name': 'Municipal Code',
                'children': [],
            },
            {
                'name':
                'City Business',
                'children': [
                    {
                        'name': 'Getting and Giving Land'
                    },
                    {
                        'name': 'Intergovernmental Agreement'
                    },
                    {
                        'name': 'Lease Agreement'
                    },
                    {
                        'name': 'Vacation of Public Street'
                    },
                ],
            },
            {
                'name': 'Finances',
                'children': [{
                    'name': 'Bonds'
                }],
            },
            {
                'name': 'Appointment',
                'children': [],
            },
            {
                'name': 'Oath of Office',
                'children': [],
            },
            {
                'name': 'Airports',
                'children': [],
            },
            {
                'name': 'Special Funds',
                'children': [{
                    'name': 'Open Space Impact Funds'
                }],
            },
            {
                'name': 'Inspector General',
                'children': [],
            },
            {
                'name':
                'Council Matters',
                'children': [
                    {
                        'name': 'Call for Action'
                    },
                    {
                        'name': 'Transfer of Committee Funds'
                    },
                    {
                        'name': 'Correction of City Council Journal'
                    },
                    {
                        'name': 'Next Meeting'
                    },
                ],
            },
        ]
    }, {
        'name':
        'Ward matters',
        'children': [
            {
                'name':
                'Business Permits and Privileges',
                'children': [{
                    'name': 'Grant of privilege in public way'
                }, {
                    'name': 'Awnings'
                }, {
                    'name': 'Sign permits'
                }, {
                    'name': 'Physical barrier exemption'
                }, {
                    'name': 'Canopy'
                }],
            },
            {
                'name':
                'Residents',
                'children': [
                    {
                        'name': 'Handicapped Parking Permit'
                    },
                    {
                        'name': 'Residential permit parking'
                    },
                    {
                        'name': 'Condo Refuse Claim'
                    },
                    {
                        'name': 'Senior citizen sewer refund'
                    },
                ],
            },
            {
                'name':
                'Land Use',
                'children': [
                    {
                        'name': 'Zoning Reclassification'
                    },
                    {
                        'name': 'Liquor and Package Store Restrictions'
                    },
                ],
            },
            {
                'name':
                'Parking',
                'children': [
                    {
                        'name': 'Loading/Standing/Tow Zone'
                    },
                    {
                        'name': 'Parking Restriction'
                    },
                ],
            },
            {
                'name':
                'Economic Development',
                'children': [
                    {
                        'name': 'Special Service Area'
                    },
                    {
                        'name': 'Tax Incentives'
                    },
                    {
                        'name': 'Tax Increment Financing'
                    },
                ],
            },
            {
                'name':
                'Traffic',
                'children': [
                    {
                        'name': 'Traffic signs and signals'
                    },
                    {
                        'name': 'Vehicle Weight Limitation'
                    },
                ],
            },
            {
                'name': 'Churches and Non-Profits',
                'children': [{
                    'name': 'Tag Day Permits'
                }],
            },
            {
                'name': 'Redevelopment Agreement',
                'children': [],
            },
        ],
    }, {
        'name':
        'Individual matters',
        'children': [
            {
                'name':
                'Small Claims',
                'children': [
                    {
                        'name': 'Damage to vehicle claim'
                    },
                    {
                        'name': 'Damage to property claim'
                    },
                    {
                        'name': 'Settlement of Claims'
                    },
                    {
                        'name': 'Excessive water rate claim'
                    },
                ],
            },
            {
                'name':
                'Honorifics',
                'children': [
                    {
                        'name': 'Honorific Resolution'
                    },
                    {
                        'name': 'Honorary street'
                    },
                ],
            },
        ],
    }]
Example #14
0
 def test_value(self):
     value = Value('default', environ=False)
     self.assertEqual(value.setup('TEST'), 'default')
     with env(DJANGO_TEST='override'):
         self.assertEqual(value.setup('TEST'), 'default')
 def test_value(self):
     value = Value('default', environ=False)
     self.assertEqual(value.setup('TEST'), 'default')
     with env(DJANGO_TEST='override'):
         self.assertEqual(value.setup('TEST'), 'default')
Example #16
0
 def test_value_var_equal(self):
     value1 = Value('default')
     value2 = Value('default')
     self.assertEqual(value1, value2)
     self.assertTrue(value1 in ['default'])
Example #17
0
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'config.wsgi.application'

# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases

DATABASE_URL = Value(
    "postgres://*****:*****@db:5432/chat",
    environ_name="DATABASE_URL",
    environ_prefix="",
)
DATABASES = {"default": dj_database_url.parse(DATABASE_URL)}
# "default": dj_database_url.parse(DATABASE_URL),
DATABASES["default"]["ATOMIC_REQUESTS"] = True

# Password validation
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME':
        'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
Example #18
0
 def test_value_falsey(self):
     value = Value()
     self.assertFalse(bool(value))
Example #19
0
 def test_value_truthy(self):
     value = Value('default')
     self.assertTrue(bool(value))
Example #20
0
class Default(DeploymentConfig, JurisdictionConfig, Base):

    # Application definition

    INSTALLED_APPS = (
        'toronto',
        'councilmatic_core',
        'haystack',
        'django.contrib.admin',
        'django.contrib.auth',
        'django.contrib.contenttypes',
        'django.contrib.sessions',
        'django.contrib.messages',
        'django.contrib.staticfiles',
    )

    try:
        INSTALLED_APPS += EXTRA_APPS
    except NameError:
        pass

    MIDDLEWARE_CLASSES = (
        'django.middleware.security.SecurityMiddleware',
        'django.contrib.sessions.middleware.SessionMiddleware',
        'django.middleware.cache.UpdateCacheMiddleware',
        'django.middleware.common.CommonMiddleware',
        'django.middleware.csrf.CsrfViewMiddleware',
        'django.contrib.auth.middleware.AuthenticationMiddleware',
        'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
        'django.contrib.messages.middleware.MessageMiddleware',
        'django.middleware.clickjacking.XFrameOptionsMiddleware',
        'django.middleware.cache.FetchFromCacheMiddleware',
    )

    ROOT_URLCONF = 'councilmatic.urls'

    TEMPLATES = [
        {
            'BACKEND': 'django.template.backends.django.DjangoTemplates',
            'DIRS': [],
            'APP_DIRS': True,
            'OPTIONS': {
                'context_processors': [
                    'django.template.context_processors.debug',
                    'django.template.context_processors.request',
                    'django.contrib.auth.context_processors.auth',
                    'django.contrib.messages.context_processors.messages',
                    'councilmatic_core.views.city_context',
                    'toronto.views.toronto_context',
                ],
            },
        },
    ]

    WSGI_APPLICATION = 'councilmatic.wsgi.application'

    # Internationalization
    # https://docs.djangoproject.com/en/1.8/topics/i18n/

    LANGUAGE_CODE = 'en-us'

    TIME_ZONE = Value('America/Toronto')

    USE_I18N = True

    USE_L10N = True

    USE_TZ = True

    # Static files (CSS, JavaScript, Images)
    # https://docs.djangoproject.com/en/1.8/howto/static-files/

    STATIC_URL = '/static/'
    STATIC_ROOT = os.path.join(BASE_DIR, 'static')

    HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor'
Example #21
0
 def test_env_var(self):
     value = Value("default")
     self.assertEqual(value.setup("TEST"), "override")
     self.assertEqual(str(value), "override")
     self.assertNotEqual(value.setup("TEST"), value.default)
     self.assertEqual(value.to_python(os.environ["DJANGO_TEST"]), value.setup("TEST"))
Example #22
0
 def test_value_with_default(self):
     value = Value('default', environ=False)
     self.assertEqual(type(value), type('default'))
     self.assertEqual(value, 'default')
     self.assertEqual(str(value), 'default')
Example #23
0
class Base(Configuration):
    OCDAPI_BASE_URL = Value('https://toronto-ocd-api.herokuapp.com')

    ALLOWED_HOSTS = ListValue(['*'])