This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.conf import settings | |
from django.core import mail | |
from django.template.context import make_context | |
from django.template.loader import get_template | |
from django.template.loader_tags import BlockNode, ExtendsNode | |
class BaseEmailMessage(mail.EmailMultiAlternatives): | |
template_name = None | |
context = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
jest.unmock('../CheckboxWithLabel'); | |
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import TestUtils from 'react-addons-test-utils'; | |
import CheckboxWithLabel from '../CheckboxWithLabel'; | |
describe('CheckboxWithLabel', () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.urlresolvers import reverse | |
from rest_framework import status | |
from rest_framework.test import APITestCase | |
from foodster.apps.core.models import Account | |
class AccountTests(APITestCase): | |
def test_create_account(self): | |
""" | |
Ensure we can create a new account object. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROJECT := demo | |
LOCAL_PATH := $(CURDIR)/src | |
VIRTUAL_ENV := $(CURDIR)/bin | |
PYTHON_PATH := $(LOCAL_PATH) | |
PYTHON_BIN := $(VIRTUAL_ENV)/scripts | |
SETTINGS := development | |
DJANGO_SETTINGS_MODULE = $(PROJECT).settings.$(SETTINGS) | |
DJANGO_POSTFIX := --settings=$(DJANGO_SETTINGS_MODULE) --pythonpath=$(PYTHON_PATH) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EMAIL_HOST = 'smtp.gmail.com' | |
EMAIL_HOST_USER = '{username}@gmail.com' | |
EMAIL_HOST_PASSWORD = '{password}' | |
EMAIL_PORT = 587 | |
EMAIL_USE_TLS = True | |
DEFAULT_FROM_EMAIL = '{username}@gmail.com' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import unicode_literals | |
import os | |
from .base import BASE_DIR | |
LOGS_DIR = os.path.join(BASE_DIR, 'tmp/logs') | |
LOGGING = { | |
'version': 2, | |
'disable_existing_loggers': False, | |
'filters': { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> # Grab geonames from http://download.geonames.org/export/dump/ | |
>>> COUNTRY = 'UA' | |
>>> DOWNLOAD_URL = 'http://download.geonames.org/export/dump/{country}.zip'.format(country=COUNTRY) | |
>>> FILENAME = '{country}.txt'.format(country=COUNTRY) | |
>>> from urllib2 import urlopen | |
>>> import zipfile | |
>>> from cStringIO import StringIO | |
>>> rawzip = urlopen(DOWNLOAD_URL).read() | |
>>> zipdata = StringIO() | |
>>> zipdata.write(rawzip) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> # Grab timezones from http://download.geonames.org/export/dump/ | |
>>> DOWNLOAD_URL = 'http://download.geonames.org/export/dump/timeZones.txt' | |
>>> from urllib2 import urlopen | |
>>> lines = urlopen(DOWNLOAD_URL).read().split('\n')[1:] | |
>>> from apps.gis.models import TimeZone, Country | |
>>> for l in lines: | |
>>> if not len(l): break | |
>>> country_code, id, gmt_offset, dst_offset, raw_offset = l.split() | |
>>> try: | |
>>> country = Country.objects.get(id=country_code) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> # Grab countries from https://github.com/umpirsky/country-list/blob/master/country/cldr | |
>>> LANG = 'uk' | |
>>> FIELD_SUFFIX = '_uk' | |
>>> DOWNLOAD_URL = 'https://raw.githubusercontent.com/umpirsky/country-list/master/country/cldr/{lang}/country.txt' | |
>>> from urllib2 import urlopen | |
>>> lines = urlopen(DOWNLOAD_URL.format(lang=LANG)).read().split('\n') | |
>>> from apps.gis.models import Country | |
>>> for l in lines: | |
>>> if not len(l): break | |
>>> l = l.decode('utf-8') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import unicode_literals | |
import os | |
from boto.s3.connection import SubdomainCallingFormat | |
# AWS S3 | |
AWS_S3_ACCESS_KEY_ID = os.getenv('AWS_S3_ACCESS_KEY_ID') | |
AWS_S3_SECRET_ACCESS_KEY = os.getenv('AWS_S3_SECRET_ACCESS_KEY') | |
AWS_S3_BASE_URL = 's3.amazonaws.com' | |
# AWS_S3_FILE_BUFFER_SIZE = 5242880 |
NewerOlder