Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Meine Top3-Entwicklungstools
Blog-Parade! Das Ziel, ausgerufen von MSDN Deutschland, ist dabei heute, seine Lieblings-Entwickler-Tools vorzustellen. Da will ich sogleich starten: Platz 3 nimmt das XAMPP Projekt ein. Mit dieser tollen Sammlung bekommt man alles, was man braucht, um lokal mehr oder minder schöne Webseiten zu entwickeln: Webserver, Datenbank und Emailversendeding. Und man kann es überall mit hin nehmen, z.B. auf den USB Stick. In der goldenen Mitte steht SVN, die Open-Source-Lösung zur Softwareversionierung. Da ich ja ein alter Windows-Hase bin, nutze ich VisualSVN, den meiner Meinung nach besten und schönsten SVN-Server für Windows, und TortoiseSVN als Client. SVN hat mir schon mehrfach den Arsch gerettet, zum Glück committe ich immer relativ häfig. Auch unverzichtbar beim Entwickeln von TYPO3-Extensions. Platz Numero Uno nimmt eindeutig die Eclipse IDE bei mir ein. Ohne dieses wertvolle Tool entsteht eigentlich keine Zeile Code. Die Vorteile liegen auf der Hand: kostet nix, zuverlässig, schier unendlich erweiterbar. Ich nutze dabei das Bundle "Eclipse IDE für Java EE Developers", welches zusätzlich mit PDT, Subclipse und dem Google Appengine SDK gepimpt ist. Damit ist eigentlich alles, was ich so programmiere, abgedeckt. Ich könnte noch ein wenig weiter auflisten, aber das ist jetzt nicht Sinn der Sache. Also nochmal kurz: 1. Eclipse … -
Código fonte do Django People liberado
Simon Willison anunciou em seu blog a liberação do código fonte do site Django People Segundo a informação do README do projeto, foi feito uma importação da base do código de Abril de 2008, assim, o código precisa de uma versão mais antiga do Django, a 0.97 para rodar. O código está disponível no github e o post anunciando o lançamento do código pode ser lido aqui. -
Solango Tips and Gotchas
For the last week or so I've been wrapping my brain around Solr and Solango. The whole time that I've been doing this I've had the feeling that they can do awesome, powerful things but they're documentation is so poor that I couldn't figure anything out beyond the basic examples. Ultimately I had to dig through a bunch of code and do some experimentation. Now that I've finally figured out how to do what I've been trying to do and have wrapped my brain around some of the trickier bits I'm going to share some of the gotchas and solutions I've found. -
django-cachepurge 0.1a
I have released django-cachepurge 0.1a. It is available as an egg for an easy installation with buildout or virtualenv+easy_install, for example.This package allows django to purge HTTP cache when a model instance is changed or deleted. It does this by sending asynchronous "PURGE" requests to one or more upstream HTTP cache (such as Squid or Varnish). It is inspired by Plone CacheFu components (more specifically: CMFSquidTool).Unfortunatly Django does not have a "post_commit" signal (it would be the best place to do such a job), so purge requests are sent when response has been computed: if an exception occurs during response the urls are not purged. This is done by the middleware.Pre-requisite: the cache must be configured to accept and handle "PURGE" requests from the server where the django application is hosted.Configuration on django side:The application must be the first app declared in settings.INSTALLED_APP. The reason is that it listens to the class_prepared signal to connect post_save and post_delete handlers on eligible models (more on that below). If you put other app before django-cachepurge it may miss their models. Note that the package name uses an underscore.INSTALLED_APPS = ( 'django_cachepurge', ... )add "django_cachepurge.middleware.CachePurge" in settings.MIDDLEWARE_CLASSESdefine settings.CACHE_URLS to the cache root for … -
Django Clippings for BBEdit
I took a break from Emacs this weekend to give the new version of BBEdit a spin. The first thing I noticed was that it doesn't have snippets (clippings are the accurate term) for Django. Personally, I use yasnippet in Emacs so I took an hour and converted the library I use to clippings for BBEdit in the hopes someone finds them useful. -
Find relation between two models
Today one of my teammates and I were working on a complex SQL query which was beyond Django’s ORM normal API, so we had to use the extra method to build the query. After running with a couple of issues with PostgreSQL’s GROUP BY we decided to opt quickly for subquieries, and in no time we had our query done. The problem was though, that we had to do this operation on several models that where similar to each other, the only thing that changed was the WHERE clause depending on the models involved. So I set off so find a way to automatically discover which was the relation between two models. In short time I discovered this: MyModel._meta.get_all_related_objects(). This returns a list of RelatedObject instances that tell us about which models point to MyModel though a foreign key, cool! So, let us suppose we have a Car model and a Rental model. The Rental model has a ForeingKey to Car, to know how they are related I built something like this: for r in target_model._meta.get_all_related_objects(): if r.model == ranking_model: relation = r for r in Car._meta.get_all_related_objects(): if r.model == Rental: relation = r break now in relation I have … -
Configuring Apache + mod_wsgi + django… on Virtual Box serving files from Windows 7!
If you enjoy reading about weird software combinations let me tell you about my system configuration. I am currently using Windows 7 RC as my primary development OS (I quickly replaced my XP SP3) and I am finding it quite good to use (waiting for that new Fedora with the lovely Kde 4.2 to come out). In any case. I wanted to test how to set up Apache on a linux machine, but I didn’t want to go through the hassle of partitioning my HDD (not yet) so I decided to try Sun’s Virtual Box virtualization solution. I got my Fedora 10 distro up and running in a jiffy, including the “Guest additions” that worked right out of the box (something that never really worked for me with VMWare). So, soon I started installing all the necessary packages for our project: yum install Django yum install python-psycopg2 yum install python-markdown yum install python-dateutil yum install mod_wsgi I did have to download and install the PIL library by hand because I didn’t find the appropiate package for fedora and I already knew I could downlaod the tar.gz file from their site and use the infamous setup.py install command to install it. … -
Django Serializer Updates
I've had a couple of emails and forum posts where users were having difficulty with my serialization module. The problems mostly centered around installing it correctly.I did a little work tonight to clean up the installation side of things. As a result you can now find the module in the Cheese Shop.The latest stable release for the serialization module can also be obtained by:Running -
DaGood Django breadcrumbs
Just wanted to post the code for simple creation of breadcrumbs that I use for Django. Basically it allows you instead of this: <a href="{{url_var}}">Title of breadcrumb</a> <img src="arrow.gif" /> to do this: {% breadcrumb "Title of breadcrumb" url_var %} and instead of: <a href="{% url url_name arg1 %}" >Title of breadcrumb</a> <img src="arrow.gif" /> to write this: {% breadcrumb_url 'Title of breadcrumb' url_name arg1 %} Get it at django snippets here: http://www.djangosnippets.org/snippets/1289/ The more comprehensive example can be found at my stack overflow answer to a breadcrumb question. -
Full-text search across multiple Django models using Djapian/Xapian
I recently implemented full text search in my Django web application. I am a big fan of the Xapian search engine library so I was extremely thrilled to find the Djapian project. Djapian is a Django app that enables indexing and searching of your Django models. One of the major requirements I had for my search [...] -
Expires headers lejanos y versiones de media
Un buen truco para mejorar el tiempo de carga de nuestras páginas es añadir a los archivos de media (imágenes, css, js) el header Expires (ver headers de HTML) con una fecha lejana (por ejemplo un año de diferencia). Este header define cuándo expira el archivo, es decir, hasta cuando el navegador puede considerar la respuesta del archivo válida. Esto significa que cuando el navegador descarga un archivo con header Expires puede almacenarlo en caché y utilizarlo sin tener que volver a descargarlo otra vez cuando el usuario visite de nuevo el sitio web, hasta que llegue la fecha descrita en el header Expires ... -
Migración de esquemas con django-evolution
Las migraciones o evoluciones de esquema son las modificaciones que hacemos a modelos ya creados y que afectan a la base de datos. Cuando sincronizamos por primera vez los modelos de nuestra aplicación mediante syncdb se crean las tablas necesarias para los mismos en la base de datos. Si tras esto realizamos cambios en nuestros modelos tendremos que ejecutar el comando manage.py reset aplicacion para que se borren las tablas correspondientes a nuestra aplicación y vuelvan a crearse nuevas tablas a partir de los nuevos modelos. El problema se nos plantea cuando tenemos que realizar cambios en modelos que ya estamos utilizando para almacenar datos y por lo tanto no podemos eliminar sus tablas para volver a crearlas. Esto ocurre sobre todo en los entornos de producción. Las soluciones principales son 2: Modificar nuestro modelo y realizar manualmente los cambios equivalentes en sus respectivas tablas de la base de datos ó utilizar alguna herramienta de migración de esquemas como django-evolution, South ó dmigrations. Vamos a ver cómo usar django-evolution para realizar nuestras migraciones de esquema de una forma sencilla. -
Getting the client IP address behind a proxy in Apache
Typically in my Django projects deployments I use Nginx as a front-end web server to handle static content while proxying all other requests to Apache. When the request arrives to Apache, the client IP address is 127.0.0.1. We need to configure Apache to accept the IP address from X-Real-IP or X-Forwarded-For headers set by Nginx. To solve this problem I use mod_rpaf that does exactly the opposite of mod_proxy_add_forward. In my Nginx virtualhost configuration I have something like: server { ... location / { proxy_pass http://127.0.0.1:8080; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; ... } ... } This also applies if your are using a different webserver as front-end such as Lighttpd or another instance of Apache. -
Getting the client IP address behind a proxy in Apache
Typically in my Django projects deployments I use Nginx as a front-end web server to handle static content while proxying all other requests to Apache. When the request arrives to Apache, the client IP address is 127.0.0.1. We need to configure Apache to accept the IP address from X-Real-IP or X-Forwarded-For headers set by Nginx. To solve this problem I use mod_rpaf that does exactly the opposite of mod_proxy_add_forward. In my Nginx virtualhost configuration I have something like: server { ... location / { proxy_pass http://127.0.0.1:8080; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; ... } ... } This also applies if your are using a different webserver as front-end such as Lighttpd or another instance of Apache. -
Escribir comandos de administración en Django
Muchas veces nos gustaría crear comandos propios que puedan ejecutarse mediante django-admin.py ó el manage.py de nuestro proyecto. Django permite crear comandos de administración específicos para cada aplicación de nuestro proyecto. Para crear comandos específicos, dentro de la carpeta de nuestra aplicación debemos crear un directorio llamado management y dentro de éste otro llamado commands ... -
Useful Django API's
Two useful Django API's that I've found today. -
X-UA-Compatible Django Middleware
When Microsoft's Internet Explorer 8 was released this past March, it included a fairly decent standards-compliant rendering engine. While a step forward for the web, a compliant rendering engine breaks many web sites that were developed for previous versions of IE. Internal corporate and government networks are notorious for sites that were built for IE 6 or 7 and often took advantage of bugs in the rendering engines. To prevent these sites, and others across the web, from breaking, IE 8 will sometimes use one of the older rendering engines. There are various conditions that are used to select the engine that will be used to render the page. The good news is that you, as a web developer, can instruct IE 8 to use a specific engine to render your site. This can be done by using the X-UA-Compatible HTTP header or HTML meta tag. Sunlight Labs has written middleware and a decorator for Django that will take care of sending the appropriate HTTP header. Include the following in settings.py to enable the middleware: MIDDLEWARE_CLASSES = ( ... 'compatibility.XUACompatibleMiddleware', ) The middleware will send a default X-UA-Compatible header of IE=edge for any HTML or XHTML response. The default value … -
Django Dash 2009
El 30 de mayo comenzará Django Dash. Se trata de una competición en la que hay que desarrollar la mejor aplicación web que se pueda en tan sólo 48 horas, obviamente, con Django. Se pueden inscribir equipos de hasta 3 personas. La inscripción se cierra dentro de 5 días. El equipo ganador obtendrá diversos premios... -
Portuguese Python User Group
I've created a Python User Group in Portugal. The idea is to join people who enjoy programming in Python. No membership is required to participate, experienced programmers and absolute beginners are both welcome! You can visit the site or follow us on Twitter. -
Portuguese Python User Group
I've created a Python User Group in Portugal. The idea is to join people who enjoy programming in Python. No membership is required to participate, experienced programmers and absolute beginners are both welcome! You can visit the site or follow us on Twitter. -
Review of Django 1.0 Template Development
Initially when Packt Publishing sent this ebook Django 1.0 Template Development by Scott Newman to review, I did what any self respecting Django entreprenuer with 3 project down his pants would do. I skimmed through the book to the code sections and read through the code and read about 10 lines after that. The blink that I obtained reading the book this way was not too good and I felt some of the explanation in certain sections lacking. BAD mistake! This book SHOULD NOT and I repeat SHOULD NOT be read that way. After I hunkered down and read the book cover to cover, it was then I really began to like it. So now, Django projects later, I wish that I read the book the right way the first time, because it has given me so many ideas to improve my Django code. So my advice, get this book, read it cover to cover and then revisit, bookmark or underline sections that you will revisit later. This way I found out was the way to get the maximum benefit out of this great Django reference. I really like reading technical books that know how to put forth advanced concepts … -
Django 1.1 Talk Text
This is the text from the Django 1.1 talk I gave on Friday May 15 at Algonquin College for FOSSLC's Geocamp/Summercamp 2009. I have tried to format this in a way that is well suited to skimming and easier to access from the web than reading the original slides. If you find this useful, please let me know. -
Seattle Django Users’ group
A Seattle Django Users’ group is forming. Here’s the official announcement: —— Forwarded Message From: Brian Gershon Reply-To: A group of Python users in Seattle Date: Mon, 4 May 2009 13:57:35 -0700 To: seattle-python, plone_seattle Subject: New Seattle Django User Group meeting June 2 (Save the Date) This is an invite for the newly forming [...] -
Виджет на морде
Как же сложно писать о том, что заняло у тебя столько сил и эмоций. Очень многое хочется рассказать, но почему-то трудно сформулировать и четко выразить мысль. Наверно это эмоции и неравнодушие так проявляются. Но я всё равно попробую. Обновленная Яндекс.Афиша работает на Джанге. Вот уже третий месяц как. Запустили мы её прямо в канун пятницы тринадцатого в марте! Проект получился большой, со своими особенностями. Расскажу вам про процесс разработки с допустимой детальностью. Глобальная цель была - обновить движок Яндекс.Афиши, переписав его на Django. Что да как Распил кода КВИ Ни для кого не секрет, что сервис "Куда все идут" один из сервисов Яндекса написанных на Джанге. Долгое время он был дополнением к Афише и добавлял социальный фан для пользователей. Ему и было суждено дать начало новой Афише. Мы резонно решили, что, переписывая Афишу на Джанге, нужно опираться уже на имеющийся code base КВИ. Но при разработке КВИ никто и не думал, что в последствие этот код может быть использован в другом проекте, поэтому процесс отделения и обобщения имеющихся наработок занял много времени и сил. Тогда мы впервые начали использовать наследование моделей в Джанге, т.к. многие наши сущности можно было строго разделить на общие части и какие-то сервисо-зависимые надстройки. Это кстати … -
Bericht vom dritten Django-UserGroup Treffen in Hamburg
Am Dienstag, den 12.05.2009, hat sich die Django-UserGroup Hamburg zum dritten Mal getroffen. Dank der CoreMedia AG hatten wir diesmal einen Raum mit Beamer und W-Lan zur Verfügung, so dass wir eine Reihe kurzer Vorträge halten bzw. hören konnten. Wenn wir uns nicht verzählt haben waren 17 Djangonauten anwesend. Die Vorträge orientierten sich am Format Lightning Talks, so dass jeder der wollte 5 bis 10 Minuten Zeit bekam zu einem Thema seiner Wahl etwas zu erzählen. Folgende Vorträge gab es: Django + PyAMF von @mohlendo RESTful Django am Beispiel routeconverter.com von @cpesch Django-Caching in der Praxis von @_arne [Slides] Deployment mit Fabric von @bracki [Fabric] Vorstellung von kogakure.de von @kogakure Spam-Deathmatch von @toadle [Blog-Eintrag] Des Weiteren haben wir auf dem Treffen entschieden ein Repository auf GitHub anzulegen, in dem wir Slides und Code allen zugänglich machen können. Das Master-Respository ist hier zu finden: http://github.com/mohlendo/dughh/ und zusätzlich gibt es die Domain dughh.de, welche zur Zeit einfach auf das Repository umgeleitet wird. Ausblick Das nächste Treffen wird in ca. 2 Monaten stattfinden, ankündigen werden wir das Treffen rechtzeitig hier im Blog, unter dughh.de in der Django-Gruppe auf Xing, in den News auf django-de.org und auf der django-de GoogleGroup. Jeder der schon vorab …