Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
django-mediagenerator: total asset management
We really weren't posting often enough recently. Now we'll make up for it with an advanced new asset manager called django-mediagenerator. Those of you who used app-engine-patch might still remember a media generator. This one is completely rewritten with a new backend-based architecture and muchos flexibility for the shiny new HTML5 web-apps world (see the feature comparison table). In this post I'll give you a quick intro and after that I'll make another post about some crazy stuff you can do with the media generator. Why oh why? What is an asset manager and why do you need one? Primarily, asset managers are tools for combining and compressing your JS and CSS files into bundles, so instead of many small files your website visitors only need to download a single big JS file and a single big CSS file. This is important because request latency has a much bigger impact on your site's load times than file size. You should definitely read Yahoo's Exceptional Performance and Google's Speed pages to learn more about how to improve your site's performance. The second important task of an asset manager is to help you with handling HTTP caches. This is done by renaming … -
Дизайн API Я.ру
Вчера мы открыли в бету API для Я.ру. Это был первый пост в корпоративном блоге Яндекса с кодом на Питоне, что даже породило фан-арт :-). Для меня этот запуск имеет большое эмоциональное значение, потому что машиночитаемый веб -- мой давний интерес, и этот проект -- первый неигрушечный публичный API, где я занимаюсь дизайном, и могу смотреть, как выживают на практике теоретические соображения о том, как это должно делаться. Я говорю тут от своего лица, и чтобы не возникало ложных ощущений, должен сказать, что я это всё делаю, конечно, не один. Начинал писать собственно серверную часть Иван Челюбеев. Моя текущая роль -- проектировщик и менеджер. Код пишет сейчас Костя Меренков, а со стороны Я.рушного бэкенда нам помогает Серёжа Чистович. Этот пост -- несколько заметок о том, как всё устроено внутри. Пишите в комментариях, если что-то нужно раскрыть подробнее. Сервис над сервисом Сам Я.ру -- многоуровневая кодобаза на нескольких языках и технологиях. Серверная её часть общается с внешним для себя миром по CORBA, и поэтому не подходит для публичного API. Кроме того, публичное API поддерживать тяжелее, чем внутреннее, из-за необходимости думать про обратную совместимость. Поэтому API сервиса Я.ру -- это по сути ещё один отдельный сервис, который смотрит во внешний мир через … -
A Pie... Er, API!
Source: Paul Smith (http://www.flickr.com/photos/psmith/2190712270/) It's no secret that we love data and open information. Forkinit has had an easy way to export your recipes since launch but that's not enough for us. So starting today, Forkinit has it's own API (application programming interface - a way to get raw data out of Forkinit). What we've got now is rough, very 1.0. It's read-only but open to everyone. So if you like code, you might try playing around with the following links: http://forkinit.com/api/v1/recipes/daniel/?format=json http://forkinit.com/api/v1/users/daniel/?format=json http://forkinit.com/api/v1/tags/vegan/?format=json We have plans to further open up the data access and add some more endpoints. If you've got feedback, we'd love to hear it! -
Creating your own Digg/Facebook/Tweetmeme button
This quick walkthrough is going to bring you up to speed on how to create your own social bookmarking button. The three prime examples are the famous Digg button, Facebook’s like functionality and the tweetmeme button. For an implementation look slightly above this paragraph or check out mashable’s version on the left of their post. Our button will be focusing on Fashiolista.com. Fashiolista is a social bookmarking site for fashion, which has seen rapid growth after launching at the next web. This tutorial explains the javascript (client side) aspects of the button. Feedback and improvements on the code would be greatly appreciated. You can find the full 450 lines of js on github. This is what the end result looks like: Compact Medium Large Love it! Love it! Love it! (If you are working on a shop in the fashion industry have a look at our installation instuctions.) Step 1 – The markup Its important to get the client side markup of the button right. Since other sites will be implementing this there is no way you can change it later on. The three major players each have their own way. Facebook XFBML: Async script with XFBML or Iframe Digg … -
man tar
man tar: The GNU folks, in general, abhor man pages, and create info documents instead. Unfortunately, the info document describing tar is licensed under the GFDL with invariant cover texts, which makes it impossible to include any text from that document in this man page. Most of the text in this document was automatically extracted from the usage text in the source. It may not completely describe all features of the program. -
Quick And Easy Execution Speed Testing
There have been many times when I've been programming, encounter a problem that probably involves a loop of some sort, and I think of two or more possible ways to achieve the same end result. At this point, I usually think about which one will probably be the fastest solution (execution-wise) while still being readable/maintainable. A lot of the time, the essentials of the problem can be tested in a few short lines of code. A while back, I was perusing some Stack Overflow questions for work, and I stumbled upon what I consider one of the many hidden jewels in Python: the timeit module. Given a bit of code, this little guy will handle executing it in several loops and giving you the best time out of three trials (you can ask it to do more than 3 runs if you want). Once it completes its test, it will offer some very clean and useful output. For example, today I encountered a piece of code that was making a comma-separated list of an arbitrary number of "%s". The code I saw essentially looked like this: ",".join(["%s"] * 50000) Even though this code required no optimization, I thought, "Hey, that's … -
Quick And Easy Execution Speed Testing
There have been many times when I've been programming, encounter a problem that probably involves a loop of some sort, and I think of two or more possible ways to achieve the same end result. At this point, I usually think about which one will probably be the fastest solution (execution-wise) while still being readable/maintainable. A lot of the time, the essentials of the problem can be tested in a few short lines of code. A while back, I was perusing some Stack Overflow questions for work, and I stumbled upon what I consider one of the many hidden jewels in Python: the timeit module. Given a bit of code, this little guy will handle executing it in several loops and giving you the best time out of three trials (you can ask it to do more than 3 runs if you want). Once it completes its test, it will offer some very clean and useful output. For example, today I encountered a piece of code that was making a comma-separated list of an arbitrary number of "%s". The code I saw essentially looked like this: ",".join(["%s"] * 50000) Even though this code required no optimization, I thought, "Hey, that's … -
Show Django AdminSite fields depending on the current user
Introduction The auto-created AdminSite in Django is a nifty feature for creating an administrative view of your model classes. Somehow it is not perfect, even if you want to customized it. To guide you to my problem and solution you've to know, that I implemented the SoftDelete behaviour for model classes as described by Greg Allard. It simply adds a 'deleted' field to each model marking it as deleted if its deleted in the admin site (or in some application) but never really gets deleted from the database. So in the admin site there is this field 'deleted' displayed, if you have configured it. The Problem My project has 2 different 'usergroups', the editors and the superusers. Superusers should see the 'deleted' fields, the others not. Unfortunatly that is not possible out of the box with Django. The solution I'm not the first one struggling with the user dependent display of model fields. Luke Plant found a solution for an older version of Django dealing with the field display in the add/change view. Later he updated the thing as the Django version grew. I adapted some lines of his last code for the add/change view and wrote something new to … -
Django settings.py for development and production
So you developed a Django web application and now need to deploy it into production, but still need to actively continue development (bugfixes, tweaks, adding and testing new features, etc.) In your development environment you probably had debugging enabled, performance settings disabled, used SQLite as your database, and other settings that make development easier and faster. But in production you need to disable debugging, enable performance, and use a real database such as MySQL or PostgreSQL, etc. Hopefully, your development environment can simulate your production environment as well, sort of staging, so your final tests prior to deployment provides the smallest delta. Sometimes you need to emulate the full production environment. Sometimes you need to emulate the full development environment. Sometimes a mixture of the two. This leads to the question, how do you seamlessly manage your development and production settings without adding overhead? It turns out there is quite a lot of discussion on how to setup Django settings.py that supports both a development and production environment, for example: Completely different settings.py files (usually you configure the webserver to add the production settings to the python path, and use the default (development) settings when using the dev webserver. By hostname By variable (PRODUCTION = True) We recently came across this issue when … -
Show Django AdminSite fields depending on the current user
Introduction The auto-created AdminSite in Django is a nifty feature for creating an administrative view of your model classes. Somehow it is not perfect, even if you want to customized it. To guide you to my problem and solution you've to know, that I implemented the SoftDelete behaviour for model classes as described by Greg Allard. It simply adds a 'deleted' field to each model marking it as deleted if its deleted in the admin site (or in some application) but never really gets deleted from the database. So in the admin site there is this field 'deleted' displayed, if you have configured it. The Problem My project has 2 different 'usergroups', the editors and the superusers. Superusers should see the 'deleted' fields, the others not. Unfortunatly that is not possible out of the box with Django. The solution I'm not the first one struggling with the user dependent display of model fields. Luke Plant found a solution for an older version of Django dealing with the field display in the add/change view. Later he updated the thing as the Django version grew. I adapted some lines of his last code for the add/change view and wrote something new to … -
Show Django AdminSite fields depending on the current user
Introduction The auto-created AdminSite in Django is a nifty feature for creating an administrative view of your model classes. Somehow it is not perfect, even if you want to customized it. To guide you to my problem and solution you've to know, that I implemented the SoftDelete behaviour for model classes as described by Greg Allard. It simply adds a 'deleted' field to each model marking it as deleted if its deleted in the admin site (or in some application) but never really gets deleted from the database. So in the admin site there is this field 'deleted' displayed, if you have configured it. The Problem My project has 2 different 'usergroups', the editors and the superusers. Superusers should see the 'deleted' fields, the others not. Unfortunatly that is not possible out of the box with Django. The solution I'm not the first one struggling with the user dependent display of model fields. Luke Plant found a solution for an older version of Django dealing with the field display in the add/change view. Later he updated the thing as the Django version grew. I adapted some lines of his last code for the add/change view and wrote something new to … -
Show Django AdminSite fields depending on the current user
Introduction The auto-created AdminSite in Django is a nifty feature for creating an administrative view of your model classes. Somehow it is not perfect, even if you want to customized it. To guide you to my problem and solution you've to know, that I implemented the SoftDelete behaviour for model classes as described by Greg Allard. It simply adds a 'deleted' field to each model marking it as deleted if its deleted in the admin site (or in some application) but never really gets deleted from the database. So in the admin site there is this field 'deleted' displayed, if you have configured it. The Problem My project has 2 different 'usergroups', the editors and the superusers. Superusers should see the 'deleted' fields, the others not. Unfortunatly that is not possible out of the box with Django. The solution I'm not the first one struggling with the user dependent display of model fields. Luke Plant found a solution for an older version of Django dealing with the field display in the add/change view. Later he updated the thing as the Django version grew. I adapted some lines of his last code for the add/change view and wrote something new to … -
SaaS with Django and PostgreSQL
How to isolate customer's data from one another (one database per customer). -
Django settings.py for development and production
So you developed a Django web application and now need to deploy it into production, but still need to actively continue development (bugfixes, tweaks, adding and testing new features, etc.) In your development environment you probably had debugging enabled, performance settings disabled, used SQLite as your database, and other settings that make development easier and faster. But in production you need to disable debugging, enable performance, and use a real database such as MySQL or PostgreSQL, etc. Hopefully, your development environment can simulate your production environment as well, sort of staging, so your final tests prior to deployment provides the smallest delta. Sometimes you need to emulate the full production environment. Sometimes you need to emulate the full development environment. Sometimes a mixture of the two. This leads to the question, how do you seamlessly manage your development and production settings without adding overhead? It turns out there is quite a lot of discussion on how to setup Django settings.py that supports both a development and production environment, for example: Completely different settings.py files (usually you configure the webserver to add the production settings to the python path, and use the default (development) settings when using the dev webserver. By hostname By variable (PRODUCTION = True) We recently came across this issue when … -
Django settings.py for development and production
So you developed a Django web application and now need to deploy it into production, but still need to actively continue development (bugfixes, tweaks, adding and testing new features, etc.) In your development environment you probably had debugging enabled, performance settings disabled, used SQLite as your database, and other settings that make development easier and faster. But in production you need to disable debugging, enable performance, and use a real database such as MySQL or PostgreSQL, etc. Hopefully, your development environment can simulate your production environment as well, sort of staging, so your final tests prior to deployment provides the smallest delta. Sometimes you need to emulate the full production environment. Sometimes you need to emulate the full development environment. Sometimes a mixture of the two. This leads to the question, how do you seamlessly manage your development and production settings without adding overhead? It turns out there is quite a lot of discussion on how to setup Django settings.py that supports both a development and production environment, for example: Completely different settings.py files (usually you configure the webserver to add the production settings to the python path, and use the default (development) settings when using the dev webserver. By hostname By variable (PRODUCTION = True) We recently came across this issue when … -
Django-websocket parce que sans chaussettes, le web, il pue un peu des pieds
Et oui, malgré la chaleur, malgré les vacances, la plage et l'appel de starcraft 2, malgré tout cela, je reste fidèle au poste et je publie une django app du mois. Bon ok, c'est le dernier jour du mois, mais je suis encore dans les clous. Mais par contre, vu que c'est l'été, les vacances, ... -
Mark Shuttleworth on Tribalism
Mark Shuttleworth: Tribalism is when one group of people start to think people from another group are “wrong by default”. It’s the great-granddaddy of racism and sexism. And the most dangerous kind of tribalism is completely invisible: it has nothing to do with someone’s “birth tribe” and everything to do with their affiliations: where they work, which sports team they support, which linux distribution they love. […] Let’s be clear: tribalism makes you stupid. -
Django Training in the UK
Update Mar 30 2011: I have just announced dates for Django training in London. Please see the Django Training website for more details. In Autumn 2010 I will be running several Django courses throughout the UK. There will be 2 different types of courses: Django template design – 1 day – for html/css coders who [...] -
Swoop Travel Live!
Foundry's first GeoDjango site, Swoop Travel, has gone live. -
Swoop Travel Live!
I'm pleased to announce that Foundry's first web site has gone live: Swoop Travel. Swoop Travel is a GeoDjango site using PostgreSQL and PostGIS, although very little GIS functionality is in the public-facing site at the moment - it's mainly in the backend. We built this from scratch in about a month (while juggling other projects too!) are are pretty pleased with how it's turned out. This is just the first iteration and we're looking forward to expanding the site. GeoDjango is pretty awesome. As we work on the site and get more experience, I'll post some more about some of the innards: there's quite a lot of interesting stuff in the backend, particularly admin customisations like filtering dropdowns based on landmarks within geographic regions, and so on. I'll also try to talk about the production server configuration, as GeoDjango needs a slightly different WSGI configuration to the standard run-of-the-mill Django site. -
Swoop Travel Live!
I'm pleased to announce that Foundry's first web site has gone live: Swoop Travel. Swoop Travel is a GeoDjango site using PostgreSQL and PostGIS, although very little GIS functionality is in the public-facing site at the moment - it's mainly in the backend. We built this from scratch in about a month (while juggling other projects too!) are are pretty pleased with how it's turned out. This is just the first iteration and we're looking forward to expanding the site. GeoDjango is pretty awesome. As we work on the site and get more experience, I'll post some more about some of the innards: there's quite a lot of interesting stuff in the backend, particularly admin customisations like filtering dropdowns based on landmarks within geographic regions, and so on. I'll also try to talk about the production server configuration, as GeoDjango needs a slightly different WSGI configuration to the standard run-of-the-mill Django site. -
Swoop Travel Live!
I'm pleased to announce that Foundry's first web site has gone live: Swoop Travel. Swoop Travel is a GeoDjango site using PostgreSQL and PostGIS, although very little GIS functionality is in the public-facing site at the moment - it's mainly in the backend. We built this from scratch in about a month (while juggling other projects too!) are are pretty pleased with how it's turned out. This is just the first iteration and we're looking forward to expanding the site. GeoDjango is pretty awesome. As we work on the site and get more experience, I'll post some more about some of the innards: there's quite a lot of interesting stuff in the backend, particularly admin customisations like filtering dropdowns based on landmarks within geographic regions, and so on. I'll also try to talk about the production server configuration, as GeoDjango needs a slightly different WSGI configuration to the standard run-of-the-mill Django site. -
Swoop Travel Live!
I'm pleased to announce that Foundry's first web site has gone live: Swoop Travel. Swoop Travel is a GeoDjango site using PostgreSQL and PostGIS, although very little GIS functionality is in the public-facing site at the moment - it's mainly in the backend. We built this from scratch in about a month (while juggling other projects too!) are are pretty pleased with how it's turned out. This is just the first iteration and we're looking forward to expanding the site. GeoDjango is pretty awesome. As we work on the site and get more experience, I'll post some more about some of the innards: there's quite a lot of interesting stuff in the backend, particularly admin customisations like filtering dropdowns based on landmarks within geographic regions, and so on. I'll also try to talk about the production server configuration, as GeoDjango needs a slightly different WSGI configuration to the standard run-of-the-mill Django site. -
PyvaScript - Pythonic syntax for your browser
Hey, after a lot of work in the last few weeks I'm finally ready to introduce you to one of our latest projects called PyvaScript. It's a new scripting language for your client side code with a syntax inspired by our favorite language Python. :) So let's take a closer look at what Waldemar conjured up. Why? We all know the pain resulting from switching between programming languages. Writing web projects using Django means to code in Python on the server side and (mostly) to code in JavaScript on the client side. Switching between both languages leads to many bugs and forces us to think differently in each language. This becomes even worse if we first write much of the code in one of both languages over a longer period of time and then switch over to the other one. In the end the result means unnecessary work. The goal of PyvaScript is to solve this problem by giving you the possibility to use a Python like syntax as well as common functions from Python wherever that is possible on the client side too. Thus PyvaScript addresses developers who love Python while still being able to write fast code and … -
Hookbox
Hookbox (via). For most web projects, I believe implementing any real-time comet features on a separate stack from the rest of the application makes sense—keep using Rails, Django or PHP for the bulk of the application logic, and offload any WebSocket or Comet requests to a separate stack built on top of something like Node.js, Twisted, EventMachine or Jetty. Hookbox is the best example of that philosophy I’ve yet seen—it’s a Comet server that makes WebHook requests back to your regular application stack to check if a user has permission to publish or subscribe to a given channel. “The key insight is that all application development with hookbox happens either in JavaScript or in the native language of the web application itself”.