Django community: Community blog posts RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Looking at registration patterns in Django
Most developers who have written a Django application are familiar with the admin interface. In this post I'll talk about the way the admin module uses a registration pattern to allow tools like admin.autodiscover() and admin.site.urls to do their magic. Registration patterns are useful when developing flexible and extensible libraries. By specifying an interface and allowing you to register your custom implementations, the library code remains decoupled from your own custom code. To get an idea of how these patterns work, let's take a look at the django.contrib.admin.sites module, we find a class called AdminSite which is instantiated at the bottom of the file (essentially a singleton that is used by default across your apps). The first lines of the __init__ method reveal that at the heart of this class, there's an attribute called _registry, which is a dictionary of Model classes and ModelAdmin instances. def __init__(self, name=None, app_name='admin'): self._registry = {} # model_class class -> admin_class instance When we import admin and run admin.site.register(), the register method on AdminSite is called, which performs some validation and then adds the model/modeladmin to its internal dictionary: # Instantiate the admin class to save in the registry self._registry[model] = admin_class(model, self) When … -
Looking at registration patterns in Django
Most developers who have written a Django application are familiar with the admin interface. In this post I'll talk about the way the admin module uses a registration pattern to allow tools like admin.autodiscover() and admin.site.urls to do their magic. Registration patterns are useful when developing flexible and extensible libraries. By specifying an interface and allowing you to register your custom implementations, the library code remains decoupled from your own custom code. To get an idea of how these patterns work, let's take a look at the django.contrib.admin.sites module, we find a class called AdminSite which is instantiated at the bottom of the file (essentially a singleton that is used by default across your apps). The first lines of the __init__ method reveal that at the heart of this class, there's an attribute called _registry, which is a dictionary of Model classes and ModelAdmin instances. def __init__(self, name=None, app_name='admin'): self._registry = {} # model_class class -> admin_class instance When we import admin and run admin.site.register(), the register method on AdminSite is called, which performs some validation and then adds the model/modeladmin to its internal dictionary: # Instantiate the admin class to save in the registry self._registry[model] = admin_class(model, self) When … -
Create Your Own Local Copy of the Django Documentation
sudo easy_install Sphinx Inside your local SVN checkout of Django: cd docs make html Now you’ll have a beautiful local copy of the documentation to browse for those rare moments when you’re away from the internet (perhaps you’re in a fort?). Just point your browser to: file:///path/to/your/django/docs/_build/html/index.html Source eddymulyono -
Simple integration with GitHub - django-github
django-github is a Django app for integration with GitHub. -
How we create and deploy sites fast with virtualenv and Django
A commenter on my last post was curious how we use virtualenv to deploy sites and how it is helpful. It goes a bit deeper than that. There are a few parts that make everything work. Pieces of the puzzle Philosophy of modular, pluggable applications with well-defined dependencies. Ideally I would love for someone to be able to check off the applications that they need in a project and everything is ready. We’re not there yet, but it is a great goal. Easy source repository creation and access management. We started on Subversion, and creating a new repository for a new modular app was a bit of a pain. If there is pain, it is avoided, so the repository wouldn’t get created. ProjectMgr (and then django-repositories) evolved out of that problem. Easy creation, sharing and access management from the Django admin. Automated project and application setup. This piece fit into place with something called Django Project Skeleton I saw from Eric Florenzano and for the life of me, I can’t remember where and can’t locate it now. Somewhere he published some code for creating a project with virtualenv with a simple command. So major props to Eric for the very cool idea and code. We … -
The power of Q
Q objects are a great tool in Django -
Benefits of moving to Django
Join the revolution – new possibilities are opened up by the switch to Django. -
Benefits of moving to Django
Join the revolution – new possibilities are opened up by the switch to Django. -
Benefits of moving to Django
Join the revolution – new possibilities are opened up by the switch to Django. -
.NET magazine features expert article by Mercurytide
The article focuses on our experiences of moving to Django from an older framework and how it affected our business. -
.NET magazine features expert article by Mercurytide
The article focuses on our experiences of moving to Django from an older framework and how it affected our business. -
.NET magazine features expert article by Mercurytide
The article focuses on our experiences of moving to Django from an older framework and how it affected our business. -
Creant Bits, el déjà vu
Em complau anunciar una segona edició de Creant Bits destinada a tots aquells i aquelles que no poguéreu assistir a la primera. Els contingut seran bàsicament els mateixos, en tot cas mirarem de resoldre algunes mancances de la primera presentació, però en un 99% serà tot el mateix: Introducció bàsica al llenguatge Python, amb exercicis. Introducció a Django: arquitectura i possibilitats Instal·lació d'una aplicació Django a Apache. La sala serà la mateixa que a la presentació anterior. Creant Bits, el déjà vu 29 de gener de les 16:00 a les 21:00 Sala de Formació - Parc Bit Pensau a dur el portàtil carregat amb el Python instal·lat. Hi ha connexió inhalàmbrica a la sala i el Parc Bit ens deixa un projector. La sala té una capacitat per a 20 persones màxim. Per apuntar-vos deixau un comentari a aquest apunt. Per cert, aquesta vegada tampoc hi ha catering! :) 23 comentaris, 0 trackbacks (URL) Automatic translations of this post by Apertium -
django-forum
twitter ready version: We have released a Django forum application, with some cool features not in any other Django based forum. You can get it here or see it in action. blog version There are quite a few Django based forum applications, so why another? Its a bit of a rhetorical question, as the answer [...] No related posts. -
Dynamic Translation Apps for Django
When I needed multi-language flatpages and flatblocks for telvee I searched for available Django apps that do dynamic translation. By dynamic translation, I mean translations are entered and stored in the database. As I said I needed to be able to translate both full pages and chunks of text that I can include into another [...] -
What a difference a year makes
The end of the year makes me reminisce about all that happened in the past 12 months. Web development at The Washington Times has changed dramatically, both in technology and process. Here are just a few things that have changed: From To Django 0.91 Django 1.1 mod_python mod_wsgi No virtualenv usage using virtualenv One site 8+ internal/external sites 5-6 content servers 1 content server + Varnish (and a backup for each and without hardware upgrades) Just servers Heavy usage of virtual machines Painful and manual deployment process Quick deployment process with Fabric Tightly integrated apps and a monolithic site More modular site with apps in separate repositories One private svn repository 50+ public and private svn and git repositories Five team members Six team members PostgreSQL 8.1 PostgreSQL 8.3 Subversion Git Python 2.3 Python 2.6 There were also some new improvements: Created a new framework for starting and deploying sites and creating apps Dramatically improved the monitoring of our infrastructure Released 30 apps under an open source license Began mirroring our public repositories on Git Hub Created a web site for our department with a blog and showing our open sourced projects Increased our focus on tests and documentation Converted an external PHP website to internal Django site, … -
Django 1.2 alpha 1 lançado
Django 1.2 alpha 1 lançado -
Django 1.2 alpha 1 lançado
Django 1.2 alpha 1 lançado -
Send someone from a charity to DjangoSki
Thanks to sponsorship from the Python Software Foundation we've got some free tickets to give away to people from charities or non-profits. Do you know someone who uses Django in a charity? Or are you at a charity? Do you use Django or want to learn about it? Like skiing, snowboarding or just hanging out in Whistler? Then nominate someone, or yourself. We've got a limited number of tickets and time is short - so hop to it. Fill out the form here. Note: the image isn't relevant, but was one of the first hits on Flickr for ticket. It's much colder in Whistler. Update: people chosen and contacted. -
Sechstes Treffen der Django-UserGroup Hamburg
Das sechste Treffen der Django-UserGroup Hamburg findet am Dienstag, den 12.01.2010 um 19:30 statt. Wie bei den letzten Malen treffen wir uns wieder in den Räumen der CoreMedia AG in der Ludwig-Erhard-Straße 18 in 20459 Hamburg. Eine Anfahrtsbeschreibung gibt es via Google Maps. Bitte am Eingang Ludwig-Erhard-Straße 18 bei CoreMedia AG klingeln, in den 3. Stock fahren und oben am Empfang nach der Django-UserGroup fragen. Da wir in den Räumlichkeiten einen Beamer zur Verfügung haben hat jeder Teilnehmer die Möglichkeit einen kurzen Vortrag (Format: Lightning Talks oder etwas länger) zu halten. Ich werde diesmal ein bisschen über den neu gegründeten Deutschen Django-Verein erzählen und bei Interesse einen Überblick über die Änderungen im Django-Trunk der letzten Tage/Wochen geben, da sich in Vorbereitung auf das 1.2 Release bereits einige Interessante Änderungen ergeben haben. Weitere Vorträge von anderen Teilnehmern ergeben sich erfahrungsgemäß vor Ort. Eingeladen ist wie immer jeder der Interesse hat sich mit anderen Djangonauten auszutauschen. Eine Anmeldung ist nicht erforderlich. Weitere Informationen über die UserGroup gibt es in unserem Git Repository unter www.dughh.de und im Wiki des Deutschen Django-Vereins. -
Getting Django + MySQL running again on Snow Leopard
Previously… Install the latest Xcode Tools from your Snow Leopard installation DVD Re symlink things to /Library/Python/2.6/site-packages (Leopard used 2.5) Django Any other thing you had symlink’d in 2.5 MySQL + Python Install MySQL from source like Dan says but use the latest version of MySQL (5.1.42 in my case) instead of the version he [...] -
An App Engine limitation you didn't know about
You probably know all of App Engine's documented datastore limitations. An important one is that a single entity can't have more than 5000 index entries. Usually this means that you have to be careful with queries that have multiple filters on a ListProperty (or StringListProperty, of course). If the query needs a composite index (in index.yaml) this can lead to an exploding index. Basically, when filtering on a ListProperty you should neither order() your query nor use inequality filters on any properties. In other words, you're safe when you only use equality filters and no ordering. Right? Wrong, unfortunately. And this leads us to a limitation most people don't know about. In some cases you need a composite (and possibly exploding) datastore index even if you follow that rule! In fact, this is also true if you don't work with a ListProperty. It's just much less likely. What are the circumstances that lead to this misery? This is the problem. There's no simple rule that you could follow. I'll try to explain it as well as I can. Merge-join When you run a query that only has equality filters the datastore (normally) doesn't need a composite index. Instead, it tries … -
Si House fos programador ...
Ahir estava mirant la presentació de James Bennet a la DjangoCon anomenada "UR DOIN IT WRONG" i me'n vaig adonar que feia referència a una sèrie de màximes tipus: #11919 No. You must believe the ERROR MESSAGE. You MUST believe the error message. La conferència és molt bona, us la recoman. El cas, però, és que em va picar la curiositat i vaig seguir l'enllaç fins a arribar a una entrada de comp.lang.perl.misc del març del 2002 on Mark Jason Dominus feia una relació de consells que ell tenia a un arxiu anomenat File of Good Advice. Les màximes, encara que plenes de sentit comú, tenen una mala llet considerable, i m'han recordat al nostre metge de la tele favorit. Supòs que no desapareixeran de la xarxa, però per si un cas les torn a escriure aquí. Ha passat temps, però la majoria són perfectament aplicables! Esper que les disfruteu tant com jo ho he fet. #11900 You cannot just paste code with no understanding of what is going on and expect it to work. #11901 You can't just make shit up and expect the computer to know what you mean, Retardo! #11902 You said it didn't work, but you … -
ESI using varnish and django
In my previous post [2] I wrote that Varnish [1] has much more to offer than upstream cache. I have decided to explore its ESI supports [3].ESI : Edge Side Includes (ESI) is an XML-based markup language that provides a means to assemble resources in HTTP clients. Unlike other in-markup languages, ESI is designed to leverage client tools like caches to improve end-user perceived performance, reduce processing overhead on the origin server, and enhanced availability. ESI allows for dynamic content assembly at the edge of the network.On of the most common difficulties that leads you to not cache a page for a logged in user is that you want to display some custom information for that user. For example you want to be able to display: * " welcome joes, [ link to his profile ] "However the rest of the page will be common for all the users. The diagram below explains the composition of the page : The yellow part of the page is common for all the users where the green part of the page should be customized for every user.This is a very common pattern, you can also have a header, footer and a navigation block that don't change very often and the rest of the … -
New Year, New Site
It's a new year and time to roll out a new site over at http://gregnewman.org. This is something I've been trying to get done for a long time now and just haven't been able to find the time or inspiration to get it done. I even failed at sitesprint twice in this endeavor. Then came along Anton Peck with this bright idea to do a post per week for a year, hence Project 52. I couldn't resist. It's a doable goal in my opinion and apparently over 500 other people think so too. hello!newman One of the things I have wanted to do was write and post more of my personal artwork. I haven't done it in the past for many reasons but one that stands out for me is the fact that I didn't want to flood the developers with art and didn't want to flood the artists with code. So I wrote this engine dubbed `hello!newman` using Django to help segregate the content a little better and each journal has it's own feeds. hello!newman is up on github and will be an ongoing project for me as this site evolves. Please feel free to comment here or create …