mkdir -p ~/bin ~/lib/python2.6/site-packages
Configure the environment by putting something like this in your
.bashrc
and sourcing it:export CFLAGS=-I/usr/local/pgsql/include export LDFLAGS=-L/usr/local/pgsql/lib
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
# encoding: utf-8 | |
# Derived from Piotr Maliński's example with a few modifications to use logging and : | |
# http://www.rkblog.rk.edu.pl/w/p/profiling-django-object-size-and-memory-usage-pympler/ | |
from pympler.muppy import muppy | |
from pympler.muppy import summary | |
from pympler.asizeof import asizeof | |
from django.conf import settings | |
import logging |
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
# -*- encoding: utf-8 | |
import functools | |
import inspect | |
def memoize(*args, **kwargs): | |
""" | |
Generic memoization decorator | |
Basic usage:: |
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
# Monkeypatch this since Django 1.1 provides no way for you to | |
# provide instance-specific filenames: | |
media_file.file.field.generate_filename = lambda i, j: os.path.join( | |
media_file.created.strftime(settings.FEINCMS_MEDIALIBRARY_UPLOAD_TO), # Default behaviour | |
"%s_resources" % os.path.dirname(new_page_path).split("/")[-1], # Plus the containing page's slug | |
os.path.basename(fs_path) # Plus the actual filename | |
) |
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
""" | |
Support for embedding blogs as FeinCMS ApplicationContent | |
""" | |
from django import forms | |
from .models import Blog | |
from .views import blog_detail | |
def get_admin_fields(form, *args, **kwargs): |
- Download and install FreeType, GDAL Complete, Postgres and PostGIS from http://www.kyngchaos.com/software:postgres and http://www.kyngchaos.com/software:frameworks
- Add /usr/local/pgsql/bin to $PATH
Setting up a new virtualenv
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
/* | |
Loads http://github.com/geuis/helium-css for testing without modifying the source pages | |
Crunched by http://ted.mielczarek.org/code/mozilla/bookmarklet.html to: | |
javascript:(function(){(function(msg,target){var loader=function(){if(arguments.callee._executed)return;arguments.callee._executed=true;if(typeof target==="function"){target();}else{jQuery.getScript(target);}var el=document.createElement('div');el.style.position='absolute';el.style.height='30px';el.style.width='200px';el.style.margin='0 auto 0 auto';el.style.top='0';el.style.left='40%';el.style.padding='5px 10px';el.style.backgroundColor='#F00';el.style.fontWeight="bold";el.style.textAlign="center";el.innerHTML=msg;document.body.appendChild(el);window.setTimeout(function(){jQuery(el).fadeOut('slow',function(){jQuery(this).remove();});},2500);};if(typeof jQuery!=='undefined'){loader();}else{var s=document.createElement('script');s.type="text/javascript";s.setAttribute('src',document.location.protocol+'//ajax.googleapis.com/ajax/libs |
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
try: | |
from south.modelsinspector import add_introspection_rules | |
from django.db.models.fields import NOT_PROVIDED | |
from django.conf import settings | |
JSONField_introspection_rule = ( | |
(JSONField,), | |
[], | |
{ | |
"null": ["null", {"default": False}], |
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
def south_field_triple(self): | |
"""Help South introspect this field for migrations""" | |
# Since we're just a TextField with some marshalling logic we'll introspect TextField | |
from south.modelsinspector import introspector | |
field_class = "django.db.models.fields.TextField" | |
args, kwargs = introspector(self) | |
return (field_class, args, kwargs) |
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
diff --git a/tornado/httpclient.py b/tornado/httpclient.py | |
index 23496d7..c6e61ee 100644 | |
--- a/tornado/httpclient.py | |
+++ b/tornado/httpclient.py | |
@@ -343,6 +343,9 @@ def _curl_setup_request(curl, request, buffer, headers): | |
functools.partial(_curl_header_callback, headers)) | |
except: | |
# Old version of curl; response will not include headers | |
+ if not hasattr(_curl_setup_request, "__broken_curl_warning_shown"): | |
+ logging.warning("CAUTION: the version of curl installed is too old; HTTP headers will be unavailable!") |