Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Integrating the flask microframework with the peewee ORM
I'd like to write a post about a project I've been working on for the past month or so. I've had a great time working on it and am excited to start putting it to use. The project is called flask-peewee -- it is a set of utilities that bridges the python microframework flask and the lightweight ORM peewee. It is packaged as a flask extension and comes with the following batteries included: Admin interface a-la django RESTful API toolkit a-la tastypie Authentication system The documentation provides in-depth explanations on the usage of these features, but if you are already familiar with django things shouldn't look too strange. The purpose of this post will be to highlight the main features of the project and discuss a little bit about their implementation. Admin interface Users of the django framework often say how valuable the admin interface is. It is, for many site managers, their primary means of interacting with django-powered sites, and for developers it is great for rapid prototyping. Considering this, one of the first things that bit me when I started working with flask was that there was no admin interface. Several times I've stopped a project before it … -
Integrating the flask microframework with the peewee ORM
I'd like to write a post about a project I've been working on for the past month or so. I've had a great time working on it and am excited to start putting it to use. The project is called flask-peewee -- it is a set of utilities that bridges the python microframework flask and the lightweight ORM peewee. It is packaged as a flask extension and comes with the following batteries included: Admin interface a-la django RESTful API toolkit a-la tastypie Authentication system The documentation provides in-depth explanations on the usage of these features, but if you are already familiar with django things shouldn't look too strange. The purpose of this post will be to highlight the main features of the project and discuss a little bit about their implementation. Admin interface Users of the django framework often say how valuable the admin interface is. It is, for many site managers, their primary means of interacting with django-powered sites, and for developers it is great for rapid prototyping. Considering this, one of the first things that bit me when I started working with flask was that there was no admin interface. Several times I've stopped a project before it … -
DjangoMaine.com - Django User group in Portland Maine
When I was at DjangoCon a few weeks ago, it was great hanging out with all of the fellow Djangonauts talking about Django and all of other great technologies. Now that I'm home, I have decided to get off my butt and do something I should have done a while ago. Without further ado, I am pleased to announce the creation of DjangoMaine.com, a new Django user group based in Portland Maine. We plan on meeting monthly to discuss Django and other python related technologies. We are currently looking for members, and topic ideas for future meetings. If you have any ideas or you are interesting in hearing more, check out our website http:///www.DjangoMaine.com -
State of Django Explorer
State of Django Explorer -
Tmux scripting
I usually need to run more than 1 command for some project and got tired of searching through those putty windows for the session I want. So I thought of using a terminal multiplexer like Tmux. I’m using celery with two queues and I need to run this: manage.py celeryd -Q queueA manage.py celeryd -Q queueB manage.py celerycam -E I need celerycam because it will get those stats in djcelery up to date. It’s also a good idea to tail the postgresql log – when you break your models or database in some cases Django isn’t very helpful so this helps a lot: tail -f /var/log/postgresql/postgresql-8.4-main.log I use a wide screen so I want a layout like this: +------------------------------------+-------------------+ | | | | runserver | | | | celerycam | +------------------------------------+ | | | | | celeryd +-------------------+ | | | +------------------------------------+ | | | postgresql log | | celeryd | | | | | +------------------------------------+-------------------+ I also want to start a new tmux session from the same command so I can close everything easily – those celeryd’s don’t reload automatically :( You’d usually run something like: tmux new-session "tmux splitw 'command1'; tmux splitw 'command3'; tmux splitw 'command3'; command4" but … -
Tmux scripting
I usually need to run more than 1 command for some project and got tired of searching through those putty windows for the session I want. So I thought of using a terminal multiplexer like Tmux. I'm using celery with two queues and I need to run this: manage.py celeryd -Q queueA manage.py celeryd -Q queueB manage.py celerycam -E I need celerycam because it will get those stats in djcelery up to date. It's also a good idea to tail the postgresql log - when you break your models or database in some cases Django isn't very helpful so this helps a lot: tail -f /var/log/postgresql/postgresql-8.4-main.log I use a wide screen so I want a layout like this: +------------------------------------+-------------------+ | | | | runserver | | | | celerycam | +------------------------------------+ | | | | | celeryd +-------------------+ | | | +------------------------------------+ | | | postgresql log | | celeryd | | | | | +------------------------------------+-------------------+ I also want to start a new tmux session from the same command so I can close everything easily - those celeryd's don't reload automatically :( You'd usually run something like: tmux new-session "tmux splitw 'command1'; tmux splitw 'command3'; tmux splitw 'command3'; command4" but … -
Tmux scripting
I usually need to run more than 1 command for some project and got tired of searching through those putty windows for the session I want. So I thought of using a terminal multiplexer like Tmux. I'm using celery with two queues and I need to run this: manage.py celeryd -Q queueA manage.py celeryd -Q queueB manage.py celerycam -E I need celerycam because it will get those stats in djcelery up to date. It's also a good idea to tail the postgresql log - when you break your models or database in some cases Django isn't very helpful so this helps a lot: tail -f /var/log/postgresql/postgresql-8.4-main.log I use a wide screen so I want a layout like this: +------------------------------------+-------------------+ | | | | runserver | | | | celerycam | +------------------------------------+ | | | | | celeryd +-------------------+ | | | +------------------------------------+ | | | postgresql log | | celeryd | | | | | +------------------------------------+-------------------+ I also want to start a new tmux session from the same command so I can close everything easily - those celeryd's don't reload automatically :( You'd usually run something like: tmux new-session "tmux splitw 'command1'; tmux splitw 'command3'; tmux splitw 'command3'; command4" But … -
Profiles: Breaking Normalization
In the summer of 2010 I either saw this pattern or cooked it up myself. It is specific to the Django profiles system and helps me get around some of the limitations/features of django.contrib.auth. I like to do it on my own projects because it makes so many things (like performance) so much simpler. The idea is to replicate some of the fields and methods on the django.contrib.auth.model.User model in your user profile(s) objects. I tend to do this usually on the email , first_name , last_name fields and the get_full_name method. Sometimes I also do it on the username field, but then I also ensure that the username duplication is un-editable in any context.Sure, this breaks normalization, but the scale of this break is tiny. Duplicating four fields each with a max of 30 characters for a total of 120 characters per record is nothing in terms of data when you compare to avoiding the mess of doing lots of profile-to-user joins on very large data sets.One more thing, I've found that most users don't care about or for the division between their accounts and profiles. They are more than happy with a single form, and if they aren't, … -
Django Facebook 2.0 – Integrating Facebook
Django Facebook 2.0 – Integrating Facebook. Weils im Moment interessant ist (jaja, ich weiss, alles macht G+, aber man soll ja antizyklisch handeln), hier ein Link zu einer Django-Library mit der man Open Graph Apps für Facebook bauen kann. Könnte gerade zusammen mit der neuen Timeline von Facebook wieder interessant werden. Und G+? Naja, solange die nur armselige Spar-APIs liefern, ist das für Bastler schlichtweg uninteressant. -
DjangoCon US 2011 Slides
The slides (and video) for my talk at DjangoCon US this year are now up. You can find the slides here, and the video is available on the DjangoCon blip.tv account. -
Petit resum d'estiu
Fa un grapat de setmanes que no escric res a aquest blog, tenc moltes coses pendents, però entre unes coses i altres el temps va passant i fins avui no he trobat una estona per a tornar-hi. Han estat unes setmanes molt estranyes: problemes personals, alguns bons, com les noces de la germana i altres no tan bons, molta feina i com no, el començament de l'escola dels menuts i la festa de la Vermada que ja és aquí. En el terreny de la feina tenc dues bones notícies: hem posat ja en producció un projecte que em fa una especial il·lusió txerpa i una web presencial fiscontrol. txerpa és un projecte que hem desenvolupat per a una coneguda gestoria/assessoria de l'illa. Integra una web, un backoffice per a la gestió d'empreses via OpenERP i la integració amb el mateix OpenERP de manera que es poden crear molt fàcilment instàncies personalitzades per a poder dur una comptabilitat i gestió. El projecte des del punt de vista tècnic ha estat molt engrescador. És un projecte amb un llarg recorregut en el qual esperam poder-hi afegint millores i nova funcionalitat. L'interessant, però, és veure que des d'aquestes illes nostres iniciatives com aquestes … -
Geo Django Quickstart
GeoDjango is a very powerful tool for storing and manipulating geographic data using the Django ORM. It provides a simple API to determine distances between two points on a map, find areas of polygons, locate the points within a polygon, and much more. GeoDjango is fairly well documented on the ... -
BestBuy Fantasy Footaball Launches
Launched back before NFL week 1. But, that was DjangoCon 2011, so the post happens today. Best Buy's site is operating for the third year in a row. Originally it was open to the public, but now it is employee only. You play by selecting a line-up every week and play against your co-workers and against the CEO. Makes for really fun team building. It uses a fantasy games framework originally developed by Rudy Menendez and myself back in 2008 for Grupo RBS's first fantasy football game ever. It's evolved quite a bit over 3 years and it's now a mature fantasy games framework that can easily handle over 1000 sign-ups an hour before you need to start rain dances for your cloud server. It's built on top of Django 1.3, PostgreSQL 9 and standard LAMP stack within Linode.com. If you would like your own fantasy game running on your site, Inquire within. -
Load Testing with JMeter: Part 1 - Getting Started
Last week, Yann Malet and I gave a talk at DjangoCon about using performance analysis to spot bottlenecks in your application. Because of the somewhat broad scope of the talk, we were only able to briefly introduce the tools we use and how we use them. Over the next several weeks, we plan to dive a little deeper into some of those tools here on our blog. To start off, I’m going to go over our JMeter setup in much more detail. It is a very powerful tool capable of complex load tests, but it is very unfriendly to new users and the documentation is not ideal. I’ll go over the basics and cover a couple of tricky things like how to authenticate, and simulating Ajax requests. This information is presented with Django in mind, but should apply to any framework you’re working with. -
Django on the high seas!
Django on the high seas! -
A tip for speakers
A tip for speakers -
This is not how to be lazy
This is not how to be lazy -
Bulk inserts in Django
I recently found a way to speed up a large data import far more than I expected.The task was to read data from a text file and create data records in Django, and the naive implementation was managing to import about 55 records per second, which was going to take far too long given the ... -
Running Django on Windows (with performance tests)
Django is a trendy Python-based framework for web applications. Its ever-growing popularity owes to availability of quick development tools, inbuilt administrative interface and high operation speed. Unfortunately, until now there was no easy tried-and-true way to deploy and run Django-apps on Microsoft IIS web-servers. Here we introduce Helicon Zoo – a solution to run popular web-frameworks and applications with Microsoft IIS. It bases on Microsoft Web Platform Installer (WebPI) technology to deploy apps. WebPI also handles different dependencies and takes care of installation of necessary components, such as Python, IIS, various database drivers and modules. And, of course, Helicon Zoo itself which sticks it all to Microsoft IIS 7+. Development environment configuration Web development process implies use of two relatively independent environments – development and production. Helicon Zoo may be used in production as well as on developer’s machine, or in both places. In either case the sequence of actions might be: To start, you need to download Web Platform Installer from Microsoft website (http://www.microsoft.com/web/downloads/platform.aspx) and install it. WebPI already includes wide range of frameworks and applications for IIS like PHP, ASP.NET, WordPress, Drupal, phpBB. To launch Helicon Zoo add new feed to WebPI: Run WebPI and click Options. In … -
Widgets, Form Fields and Model Fields Explained
In any web application user data must be translated from HTML form data to native types and database types, and back again. Django web applcations are no different. The "right way" to handle custom types is to extend Django's widgets, form fields and model fields. However, understanding exactly how these types perform each step of the conversion can be confusing. This post will attempt to explain how the data is converted at each stage and offer some advice about creating custom widgets, form fields and model fields. This article is based on Django 1.3 and assumes the reader has experience creating and using Django forms, models and validation. -
django-radius
I've been working on a little Django app for a while now, which solves a problem I often come across in Django projects. django-radius allows a developer to use a 3rd party RADIUS server to provide authentication in their Django application. Not only this, though, it also allows the use of multiple RADIUS servers, which can be specified in whichever way makes sense. This might sound a little contrived, so I'll give an example. Imagine a web service, such as a helpdesk management system, whose users are organised into groups. Each user belongs to an organisation, which buys into the service on their behalf. Basecamp and Zendesk operate this model, to name just two. To login, a user must visit a particular URL - so that the system may determine which organisation that user belongs to (http://yourcompany.zendesk.com for example). Now imagine that this service wishes to provide external authentication to its customer's systems, using RADIUS. This means that there's no need for users to have yet another password on yet another system, and is generally a Good Thing™. In this scenario, the developers would have to find some way of validating the user's credentials using the correct RADIUS server, based … -
Improving select fields in Djago with django-ajax-selects
django-ajax-selects is a handy Django application that allows substituting select fields with ajax autocompleate fields. That can be done for example for Django admin panel and ForeignKey, ManyToMany fields. It solves the problems with select fields containing a lot of values. -
A prayer to the programming gods
O gods of software development and operations, I have sinned. Your anger falls on me, and I feel your wrath... -
Django-uni-form 0.9.0 is out [security fix]
Version 0.9.0 is out and you should update because of security reasons. An XSS bug has been fixed, thanks to Charlie Denton for reporting it. If you are using django-uni-form and a form field that renders the input of a field as part of the error message without sanitizing it, such as ChoiceField, you are vulnerable to it. This is because errors are rendered using |safe filter. This has been addressed as fast as possible. Fixes for previous versions might come in the soon future. PyPi package has been update so you can do: pip install --upgrade django-uni-form This is the commit that introduced the security bug, as you can see it affects version 0.7.0 and forward versions. I want to thank every contributor and user that has made this version rock even more than previous ones. Bug fixes It’s got support for show_hidden_initial, Fieldset’s legends internationalization, error_css_class and required_css_class. MultiField layout object has fixed markup and has been optimized. Performance boost The project has seen several performance tune ups, related to templates handling, that make it run blazing fast. You can run now django-uni-form without template caching only one second slower than the cached version. Customizable templates All layout … -
Django-uni-form 0.9.0 is out [security fix]
Version 0.9.0 is out and you should update because of security reasons. An XSS bug has been fixed, thanks to Charlie Denton for reporting it. If you are using django-uni-form and a form field that renders the input of a field as part of the error message without sanitizing it, such as ChoiceField, you are vulnerable to it. This is because errors are rendered using |safe filter. This has been addressed as fast as possible. Fixes for previous versions might come in the soon future. PyPi package has been update so you can do: pip install --upgrade django-uni-form This is the commit that introduced the security bug, as you can see it affects version 0.7.0 and forward versions. I want to thank every contributor and user that has made this version rock even more than previous ones. Bug fixes It’s got support for show_hidden_initial, Fieldset’s legends internationalization, error_css_class and required_css_class. MultiField layout object has fixed markup and has been optimized. Performance boost The project has seen several performance tune ups, related to templates handling, that make it run blazing fast. You can run now django-uni-form without template caching only one second slower than the cached version. Customizable templates All layout …