Exemple #1
0
SOCIAL_AUTH_FLICKR_AUTH_EXTRA_ARGUMENTS = {'perms': 'write'}

# https://www.dropbox.com/developers/dropins/chooser/js
DROPBOX_APP_KEY = environ.get('DROPBOX_APP_KEY', '')

LOGIN_REDIRECT_URL = '/upload/'
LOGIN_URL = '/login/flickr/'
LOGIN_ERROR_URL = '/login-error/'


AUTHENTICATION_BACKENDS = (
    'social.backends.flickr.FlickrOAuth',
    'django.contrib.auth.backends.ModelBackend',
)

GEOIP_PATH = geoip_utils.where()

# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse'
        }
    },
    'handlers': {
Exemple #2
0
FLICKR_AUTH_EXTRA_ARGUMENTS = {'perms': 'write'}

# https://www.dropbox.com/developers/dropins/chooser/js
DROPBOX_APP_KEY = environ.get('DROPBOX_APP_KEY', '')

LOGIN_REDIRECT_URL = '/upload/'
LOGIN_URL = '/login/flickr/'
LOGIN_ERROR_URL = '/login-error/'

AUTHENTICATION_BACKENDS = (
    'social_auth.backends.contrib.flickr.FlickrBackend',
    'django.contrib.auth.backends.ModelBackend',
)

GEOIP_PATH = geoip_utils.where()

# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse'
        }
    },
    'handlers': {
import os
import gzip
import urllib
import urlparse

from django.core.management.base import BaseCommand, CommandError

import geoip_utils

download_folder = geoip_utils.where()


class Command(BaseCommand):
    help = 'Updates GeoIP data in %s' % download_folder
    base_url = 'http://www.maxmind.com/download/geoip/database/'
    files = ['GeoLiteCity.dat.gz', 'GeoLiteCountry/GeoIP.dat.gz']

    def handle(self, *args, **options):
        for path in self.files:
            root, filepath = os.path.split(path)
            dowloadpath = os.path.join(download_folder, filepath)
            downloadurl = urlparse.urljoin(self.base_url, path)
            self.stdout.write('Downloading %s to %s\n' % (downloadurl, dowloadpath))
            urllib.urlretrieve(downloadurl, dowloadpath)
            outfilepath, ext = os.path.splitext(dowloadpath)
            if ext != '.gz':
                raise CommandError('Something went wrong while '
                                   'decompressing %s' % dowloadpath)
            self.stdout.write('Extracting %s to %s\n' % (dowloadpath, outfilepath))
            infile = gzip.open(dowloadpath, 'rb')
            outfile = open(outfilepath, 'wb')