Community
This page, updated every hour, aggregates blog entries by people who are
writing about Django.
Posted on March 20, 2010 at 7:01 PM by Erik Scheffers
Thierry Schellenbach from YouTellMe.nl recently wrote on his blog that their site is probably the largest Django project in terms of codebase. Since their project isn’t open-source, it’s hard to tell if that claim is true or not. But it got me wondering. What is the largest open-source Django-based project around? Some times ago I already posted some ’source [...]
Read this post in context »
Posted on March 20, 2010 at 2:05 PM by Shabda Raaj
The most commonly used Rails commands and their Django equivalents Rails Django rails console manage.py shell rails server manage.py server rake None rails generate None rails dbconsole manage.py dbshell rails app_name manage.py startproject rake db:create manage.py syncdb The salient points [...] Related posts:Django for a Rails Developer The Rails and Django models layer Rosseta stone
Read this post in context »
Posted on March 19, 2010 at 12:17 PM by Thierry Schellenbach
We are completely Django based. YouTellMe.nl Stack - Django - Mod wsgi - Sqlalchemy - Solr - Jinja - Numpy And we need some love from the Django community. Lots of it. Pretty please nominate us for the next web! http://dsa.thenextweb.com/?lang=nl Good articles coming soon to offset the bad karma for this shameless plug ;)
Read this post in context »
Posted on March 18, 2010 at 11:02 PM by Andrew Godwin
It's that time of the year again, when a new South release rears its well-refactored, database-independent head.If you've been following the development of South at all, you'll know that 0.7 has been quite a while in the making. I've been busy working away at a big code refactor, along with Simon Law, who has gained the title of "Knowing Too Much About Migrations". However, there are some user-facing changes as well, some quite significant. While my release notes go into some detail on what's new, the major changes include: New command names.The old startmigration was getting a little overloaded and wasn't too well-named, so it's been split into schemamigration and databasemigration commands. No more issues with missing defaults. South realises you need a default for NOT NULL columns now, and prompts you if you forget to specify one as you're making the migration, instead of dying when you try to apply it. Django 1.2 and MultiDB support. As well as supporting the latest and greatest incarnation of the universe's best web framework, 0.7 also has some limited MultiDB support, in the form of a --database option (that works like the option of the same name on the new syncdb command ...
Read this post in context »
Posted on March 18, 2010 at 7:35 PM by Andy McKay
One of the things I wanted to work on at the DjangoSki sprints was a django query analyzer. The basic premise is that I want to create an easy way for users to experiment with and play with the ORM to produce the queries that they want. If you are new to Django, figuring out the ORM is one the first things you will need to tackle and it can be a little opaque. There's some ways to play with it at the shell, or use the debug toolbar, but these can be a little limited and unhelpful to newbies. The main interface would ideally be a series of options introspected from the model. Choose a model, choose a query manager, then add in multiple filter queries. This would not be able to capture everything and you'd always need an opt out clause of a text area where you can enter anything you want. This is pretty similar to the GUI's you'll get with most SQL servers, its just the Django ORM layer on top of it. Sadly I didn't get much chance apart from some time on Thursday afternoon. But a whole bunch of other people did including Stefan ...
Read this post in context »
Posted on March 15, 2010 at 12:49 AM by Ed Menendez
This post will show you how to create a local_contants.py file using Django South. If you're not familiar with South, it's a data migration tool. Stated differently, it's a tool that helps keep your database changes current across different sandboxes and server environments. The reason you may want to have constants is when you have a type model instance that you want to reference in your code for decision logic. For example, you might display things differently if your contact method type ID is 1 (email) vs 2 (phone). Typically, you keep these in constants.py file. Although sometimes you can put this data in a fixture, for various reasons sometimes fixtures is not the ideal solution. The code below is designed to be run inside a migration to update your local_constants.py file with data that you just migrated. local_constants.py is a locally maintained file. This means, that like your local_settings.py, it should not be in the repo. For example: set_constant('/home/projects/sample/local_constants.py', 'STAMP_MW_ID', 42 , 'Set from sample.0007_add_constants.py') The constant searching could be improved, feel free to post enhancements! def set_constant(file, constant, value, comment = ''): ''' Search through file for the constant and either adds it to the end or updates ...
Read this post in context »
Posted on March 14, 2010 at 1:26 AM by Ed Menendez
This post shows how to setup Nginx has a pass-through image proxy server. This is useful for local sandboxes, UAT and QA servers where you copy production database down to but don't want to copy all the user generated images to the non production environment.
Read this post in context »
Posted on March 13, 2010 at 11:40 PM by Josh VanderLinden
There has been quite a bit of recent activity in my 2ze.us project since I first released it nearly a year ago. My intent was not to become a competitor with bit.ly, is.gd, or anyone else in the URL-shortening arena. I created the site as a way for me to learn more about Google's AppEngine. It didn't take very long to get it up and running, and it seemed...
Read this post in context »
Posted on March 13, 2010 at 10:06 PM by Josh VanderLinden
A recent project at work has renewed my aversion to Python's exec statement--particularly when you want to use it with arbitrary, untrusted code. The project requirements necessitated the use of exec, so I got to do some interesting experiments with it. I've got a few friends who, until I slapped some sense into them, were seemingly big fans of exec (in Django projects, even...)....
Read this post in context »
Posted on March 13, 2010 at 11:08 AM by Antoni Aloy López
Què voleu, estic content de veure que una eina com pip funciona tan bé. Pip és una eina per a la instal·lació de paquets i dependències per Python, molt més avançada que easy_install ja que permet tot el que feia easy_install però a més, permet mantenir d'una manera fàcil un arxius amb totes les dependències del nostre projecte. Ens permet instal·lar paquests de Python des dels repositoris de Pypi, des de subversion, git, mercurial a través d'un fitxer de requeriments simple i a la vegada funcional. Mode batalleta on: Ahir vespre estava fent feina amb un projecte mascota que tinc, un motor de reserves per hotels i cadenes hoteleres fet amb Python i Django. El projecte necessita de força llibreries: la darrera versió de django, nose pels tests, sphinx per la documentació, django debug toolbar, django extensions, south per la migració de dades, ipython, ipdb, pep8, coverage, pytlint. Tot això (i algunes més que s'hi afegiran) constitueixen l'entorn de desnvolupament del projecte. Actualment faig feina amb tres ordinadors: el fix (el PPC del que tant he parlat per aquí), portàtil un Dell D820 i un Dell de 10". Segons on estic i el que he de fer en faig servir ...
Read this post in context »
Posted on March 11, 2010 at 9:38 PM by Dominik Szopa
django-moderation is reusable application for Django framework, that allows to moderate any model objects. Code can be found at http://github.com/dominno/django-moderation Possible use cases: User creates his profile, profile is not visible on site. It will be visible on site when moderator approves it. User change his profile, old profile data is visible on site. New data will be visible on site when moderator approves it. Features: configurable admin integration(data changed in admin can be visible on site when moderator approves it) moderation queue in admin html differences of changes between versions of objects configurable email notifications custom model form that allows to edit changed data of object 100% PEP8 correct code test coverage > 80% Requirements python >= 2.4 django >= 1.1 Installation Download source code from http://github.com/dominno/django-moderation and run installation script: $> python setup.py install Configuration Add to your INSTALLED_APPS in your settings.py: moderation Run command manage.py syncdb Register Models with moderation from django.db import models import moderation class YourModel(models.Model): pass moderation.register(YourModel) Register admin class with your Model from django.contrib import admin from moderation.admin import ModerationAdmin class YourModelAdmin(ModerationAdmin): """Admin settings go here.""" admin.site.register(YourModel, YourModelAdmin) If you want to disable integration of moderation in admin, add admin_intergration_enabled = False to ...
Read this post in context »
Posted on March 11, 2010 at 9:18 PM by Caktus Consulting Group
Like just about everyone else, we’ve written our own suite of tools to help with building complex content management systems in Django here at Caktus. We reviewed a number of the existing CMSes out there, but in almost every case the navigation and page structure were so tightly coupled the system broke down when [...]
Read this post in context »
Posted on March 11, 2010 at 7:35 PM by Simon Willison
Cache Machine: Automatic caching for your Django models. This is the third new ORM caching layer for Django I’ve seen in the past month! Cache Machine was developed for zamboni, the port of addons.mozilla.org to Django. Caching is enabled using a model mixin class (to hook up some post_delete hooks) and a custom caching manager. Invalidation works by maintaining a “flush list” of dependent cache entries for each object—this is currently stored in memcached and hence has potential race conditions, but a comment in the source code suggests that this could be solved by moving to redis.
Read this post in context »
Posted on March 10, 2010 at 5:38 PM by Josh VanderLinden
I recently found myself in a situation where knowing the execution context of a function became necessary. It took me several hours to learn about this functionality, despite many cleverly-crafted Google searches. So, being the generous person I am, I want to share my findings. My particular use case required that a function behave differently depending on whether it was called in an exec call. Specifics beyond that are not...
Read this post in context »
Posted on March 9, 2010 at 2:38 PM by Peter Bengtsson
Following on from yesterday's blog about How and why to use django-mongokit I extended the exampleproject which is inside the django-mongokit project with another app called exampleapp_sql which does the same thing as the exampleapp but does it with SQL instead. Then I added a very simple benchmarker app in the same project and wrote three functions: One to create 10/100/500/1000 instances of my class One to edit one field of all 10/100/500/1000 instances One to delete each of the 10/100/500/1000 instances [325 more words]
Read this post in context »