Django redirects with regular expressions

Sept. 2, 2013 - Alex - regex - django - python - Development - Django

We've been doing quite a few projects lately where old incoming links need redirecting to new pages (both for visitors and the much sought-after Google juice). In such projects SEO is mostly tacked-on as an afterthought and often neglected, however giving your users the tools to set this up themselves is always appreciated. The default redirects app in Django works pretty well for users, but ...

Read More

Customizing Django startproject with templates

June 6, 2013 - Alex - django - modwsgi - deployment - Development - Django - Software

When it comes to Django everyone has their own way of structuring a project. The default layout when running startproject is reasonable for smaller projects, but it quickly gets messy when those projects grow. Two Scoops of Django has a whole chapter on the subject, but rightfully states that no two developers would structure their project in the same way. The default project structure of ...

Read More

RestORM - The client side of REST

Dec. 10, 2012 - Joeri - client - django - orm - rest - Development - Software

RestORM structures the way you access a RESTful API and allows you to easily access related resources. It tries to be as generic as possible so it's not tailored to any specific API or server-side API library. With RestORM you can mock an entire API and replace the real client with a mock version in unit tests. RestORM is very extensible but offers many functionalities out of the box to get you up and running quickly.

Read More

Custom choices in Django admin

Oct. 5, 2012 - Joeri - django - admin - choicefield - ticket - Software

Allow custom choices in the Django admin in a select widget.

Read More

Nested resources in Tastypie

Oct. 2, 2012 - Joeri - django - tastypie - Software

More elegant approach to do nested resources in Django Tastypie and make authentication work while at it.

Read More

Django "view-permissions" for related objects

Feb. 9, 2010 - Joeri - django - admin - permissions - Development

You have a model A with a relation to another model B. In the Django admin, you have full permissions for model A and none for model B. However, if you create a new object for model A, you need to select a related object from model B. Tough luck: Permission denied!

Read More

Allow squid/mod_wsgi to pass the HTTP_AUTHORIZATION header to Apache

July 16, 2009 - Remco - django - apache - authorization - django-piston - modwsgi - squid - webservice - Software

So we had some issues using django-piston (a webservice framework for Django) in combination with HTTP Basic authorization. By default both Squid and mod_wsgi will not forward the HTTP_AUTHORIZATION headers to the next layer. So if you have a wsgi application that does its own authorization you need to do the following: In your squid.conf you need to add the login=PASS to the cache_peer entries ...

Read More

Using Fabric to update a remote svn checkout with ssh public key authentication

July 14, 2009 - Remco - django - python - deployment - fabric - publickey - ssh - Development

For our subversion repositories we only allow users to connect through ssh public key login. We are switching towards using Fabric for doing automated deployments (in combination with zc.buildout, which we already use). Unfortunately it seems that both Fabric and paramiko, the python library Fabric uses for making ssh connections, don't support the ForwardAgent option in ~/.ssh/config which allows you to forward your ssh-agent to ...

Read More

Using mysql load data infile with django

April 27, 2009 - Remco - django - mysql - python - import - Development

To import large amounts of CSV data from a file into a MySQL database you can use the LOAD DATA [LOCAL] INFILE command. There are some caveats using this command having to do with security. In order for LOAD DATA to work you will have to enable the command on both the server and client. To do this for the server, you can edit your ...

Read More

Latest Tweets