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
import mongoengine | |
from django.conf import settings | |
from django.core.exceptions import MiddlewareNotUsed | |
class MongoEngineConnectionMiddleware(object): | |
''' Ensure that a separate mongoengine connection is made per thread. | |
See: http://groups.google.com/group/mongoengine-users/browse_thread/thread/1aa3f9d65627c04 | |
Assumes the following is your Django settings. Tweak as needed. | |
MONGODB = { |
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
#!/usr/bin/env python | |
"""Split large file into multiple pieces for upload to S3. | |
S3 only supports 5Gb files for uploading directly, so for larger CloudBioLinux | |
box images we need to use boto's multipart file support. | |
This parallelizes the task over available cores using multiprocessing. | |
Usage: | |
s3_multipart_upload.py <file_to_transfer> <bucket_name> [<s3_key_name>] |
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 functools import update_wrapper | |
from django.contrib import admin | |
from django.contrib.admin import ModelAdmin | |
from django.contrib.admin.templatetags.admin_urls import add_preserved_filters | |
from django.core.exceptions import PermissionDenied | |
from django.shortcuts import render | |
from myapp.models import Widget | |
from myapp.forms import ManageWidgetForm |