def cdn_url(request): """ A context processor that exposes the full CDN URL in templates. """ cdn_url, ssl_url = _get_container_urls(SwiftclientStorage()) static_url = settings.STATIC_URL return { "CDN_URL": cdn_url + static_url, "CDN_SSL_URL": ssl_url + static_url, }
from __future__ import absolute_import from django.conf import settings if settings.DEFAULT_FILE_STORAGE == 'cumulus.storage.SwiftclientStorage': from cumulus.storage import SwiftclientStorage storage = SwiftclientStorage() else: from django.core.files.storage import FileSystemStorage storage = FileSystemStorage() from PIL import Image from django.db import models from localflavor.us.models import PhoneNumberField from django.core.files.base import ContentFile from datetime import date from itertools import chain from django.core.urlresolvers import reverse from django.db.models import Q from django.utils.text import slugify from django.utils.timezone import now from django.utils import timezone from .integration.meetup import get_upcoming_events from .integration.meetup import get_past_events import feedparser from django.conf import settings try: from cStringIO import StringIO except ImportError: try: from StringIO import StringIO except ImportError: from io import StringIO import base64
from django.db import models from cumulus.storage import SwiftclientStorage openstack_storage = SwiftclientStorage() class Thing(models.Model): "A dummy model to use for tests." image = models.ImageField(storage=openstack_storage, upload_to="cumulus-tests", blank=True) document = models.FileField(storage=openstack_storage, upload_to="cumulus-tests") custom = models.FileField(storage=openstack_storage, upload_to="cumulus-tests")