Skip to content

Instantly share code, notes, and snippets.

roadsideseb / sentry.conf (nginx)
Created Oct 2, 2012
Current configuration of
View sentry.conf (nginx)
server {
listen 80;
access_log /var/log/nginx/;
gzip on;
gzip_proxied any;
gzip_types text/plain application/xml application/x-javascript text/javascript text/css;
location / {
roadsideseb /
Created Jan 24, 2013
This is an unfinished managment command that I use when customising one of Oscar's core apps. It simply copies over all the files of the app (excluding subdirectories) and leaves the rest to you. I'd like to improve it at some point and make it part of Oscar but I didn't have the time for that yet. The command in action might look like this: ```…
import os
import imp
import shutil
import pkgutil
import logging
from optparse import make_option
from import BaseCommand, CommandError
roadsideseb / gist:5127613
Created Mar 10, 2013
ZenPhoto / nginx config
View gist:5127613
server {
server_name domain.tld;
root /var/www/zenphoto;
index index.php;
# pass the PHP scripts to php-fpm server
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
roadsideseb /
Created Mar 11, 2013
SearchView wrapper for haystack to bring it in line with Django 1.3+ CBV
from functools import update_wrapper
from django.conf import settings
from django.utils.decorators import classonlymethod
from django.views.generic.base import TemplateResponseMixin
from haystack.query import SearchQuerySet
from haystack.forms import FacetedSearchForm
from haystack.views import FacetedSearchView as HaystackFacetedSearchView
roadsideseb /
Created Apr 9, 2013
MultiFormView for handling multiple forms in a Django CBV with a little more ease...
The following mixins and views are borrowed and adapted from the following
from functools import partial
from django.views.generic.base import TemplateResponseMixin
from django.views.generic.edit import ProcessFormView, FormMixin
roadsideseb /
Created Jul 23, 2013
Using the 'loaddata' management command in a data migration with South is going to break things as soon as the used models change in any way (when running the migrations on a fresh install). The data loaders don't know about the frozen ORM provided by South but use the current state of the models as in the respective ''. Here's a fixtur…
from myproject.utils import loaddata
class Migration(DataMigration):
def forwards(self, orm):
loaddata(orm, 'some_fancy_fixture.json')
import xml
from boto.mws import response
from boto.handler import XmlHandler
from boto.mws.connection import MWSConnection
from unittest import TestCase
NESTED_MEMBER_LIST_XML = """<GetTestResponse>
View gist:7245572
ERROR: upload devices from inventory file
File "/usr/lib/python2.7/unittest/", line 332, in run
File "/home/elbaschid/Worx/Tangent/vodafone/tests/eshop/functional/", line 114, in test_upload_inventory
after_save_page = save_form.submit().maybe_follow()
File "/home/elbaschid/.virtualenvs/vodafone/local/lib/python2.7/site-packages/webtest/", line 538, in submit
params=fields, **args)
File "/home/elbaschid/.virtualenvs/vodafone/local/lib/python2.7/site-packages/webtest/", line 293, in goto
roadsideseb /
Created Jan 30, 2014
Packing slips for Oscar using PISA in the dashboard
from xhtml2pdf import pisa
from xhtml2pdf.pdf import pisaPDF
class OrderListView(ListView, BulkEditMixin):
actions = (
roadsideseb / base.html
Created Feb 2, 2014
Oscar packing slip / invoice templates using pisa.
View base.html
{% load staticfiles %}
<!DOCTYPE html>
<style type="text/css">
@page {
size: a4 portrait;
margin: 1cm;