Django community: Community blog posts RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Forms Part 2: Class Based Forms
Forms are generally annoying to deal with. Fortunately Django offers some great ways to work with forms to make your life easier. In this our second part on forms we walk you through Class Based Forms in Django on our way to understanding the breadth of what you can do with forms in Django.Watch Now... -
Imaginary recognized for DSF membership
Django Software Foundation president Russell Keith-Magee recently recognized Imaginary Landscape as one of the first Corporate Members of the DSF. Imaginary Landscape and one other firm were identified in the blog post appearing on the Django Weblog. "The DSF would like to thank these two companies for their generous contributions ... -
Getting DjangoCMS up and running on ActiveState's Stackato
ActiveState has recently started their own PAAS based on CloudFoundry this blog post is to help you get up and running quickly with a Django CMS installation, and hopefully give you enough information to get your own applications on there as well. To keep things simple, I'll just go through the steps that are required in order to get this up and running and add some comments along the way. If I missed anything or if you have any questions, please ask in the comments. Running on Stackato 1. Register for an account Go to http://community.activestate.com/stackato and register for your account. They are currently in beta, and you need to be approved before they will give you access. 2. Install the client There are a few different options, follow the steps outlined here. http://docs.stackato.com/quick-start.html#stackato-client-setup I tried the option where you download the file, and rename it and put it in your path. It wasn't complicated, but it wasn't clean either. I chose this option because I didn't want to install pypm, so I'm not sure if that way is easier or not. 3. Register your client to the cloud Now that you have the client installed you need to tell … -
Django in Production: Part 3 - Automation & Monitoring
This is the third part in a series about Django in Production. If you haven't already, read part 1 and part 2 first. In the first two posts of this series, I described the core stack which powers a Django application in production, and the Celery task queue which can be used to execute code asynchronously. In this third post, I'll describe how a production Django application can be monitored, and how common tasks such as deployment can be automated. Monitoring Django Applications There are many ways to monitor a Django application, but one that is particularly useful is Graphite. Graphite Graphite provides real-time visualization and storage of numeric time-seriesdata on an enterprise level. The key thing is not to be scared by the word enterprise. Graphite is a relatively simple 3-part system: Whisper is an efficient, pure-Python implementation of a round-robin database, and Carbon is a daemon which manages the Whisper database and provides caching. Finally, the Graphite "webapp" provides a Django frontend to the data stored in the Whisper database. Graphite's web interface is, admittedly, hard to use. Its redeeming feature is a powerful URL-based API which allows you to compose graphs programatically - which is in some … -
IP Street’s Senior Developer opening now more about Search, less about Python/Django
After some job market feedback and chin-scratching, I’ve changed our Senior Developer opening’s job description. Now it’s less about Python or Django, and more about search technologies, specifically full-text and LSI search. We hope candidates will have some experience with Python or Django, but search technology experience (e.g., tuning, tokenizers, parsers, relevancy rank tweaking, aggregates and pivots) in now more important, and emphasized, in the the job. Here’s the new description: ——— Founded in 2009, IP Street develops and markets software to help corporations, law firms, financial research firms, and government agencies better analyze patent information. Our goal is to make IP data easy to get, use, and understand, so everyone can have access to high quality and transparent information. A significant facet of our application’s capabilities are derived from Solr and other search technologies. We’re seeking a great full-text Search developer with experience in: Solr, Lucene, or other search engines Full-text search schemas, tokenizers, parsers, and rules for returning statistics and meaningful analytics Automated workflows that process millions of objects Data quality metrics and repairs You’ll be joining us at a great time! Revenue is coming in, and we’ve done two Angel funding rounds at increasing valuations. Key Responsibilities. … -
Installing a Django application on Red Hat's OpenShift PAAS
It seems like everyone has their own PAAS solution these days, and if they don't have one yet, it is just a matter of time before they will. Red Hat has recently joined in on the fun with their OpenShift platform. I decided to take it for a test drive, and share my results with you. This service is still in beta and things are changing all of the time, so these notes might not work in the future, take that into consideration when using it as a guide. There really isn't much python documentation for this platform, and what documentation there is, is either a little out of date, or missing some important steps. Hopefully this guide will help you get your application up and running. OpenShift is divided into two parts, Flex and Express. Flex: "Dedicated cloud solution. Get more control over your apps, or move your existing applications to the cloud with ease! Flex is a dedicated cloud solution that provides everything you need to easily scale, provision, deploy, and monitor your applications." Flex runs on top of your amazon EC2 account, and currently only supports Java and PHP. It is targeting the enterprise crowd and has … -
Django Common App (Part 1)
Here at Tivix we’ve created a number of open source apps that are available for use. In this post we’re going to talk specifically about the django-common app, which provides functionality commonly needed in a django application (in case it wasn’t obvious). WWWRedirectMiddleware WWWRedirectMiddleware redirects requests to make sure they are on the www subdomain or off the www subdomain, depending on your settings. Besides adding ‘django_common.middleware.WWWRedirectMiddleware‘ to MIDDLEWARE_CLASSES, you need to set DOMAIN_NAME in the settings, either with www or not. You need to also set IS_PROD to true, as you don’t want to redirect on localhost. SSLRedirectMiddleware and NoSSLRedirectMiddleware SSLRedirectMiddleware redirects requests to make sure that they are under https. NoSSLRedirectMiddleware makes sure they are under http. ssl_required decorator If you don’t need ssl across the entire site (you oftentimes don’t) you can simply use the ssl_required decorator on the specific view that requires https. disable_for_loaddata decorator This decorator is used to wrap signals instead of views. It disables signals from being fired when the loaddata command is run. See: https://code.djangoproject.com/ticket/8399 EmailBackend The EmailBackend is an authentication backend that works like the default ‘django.contrib.auth.backends.ModelBackend‘ except it finds users by email instead of username. To use it simply add … -
Using django-compressor on ep.io
This is a small tip to how to get django-compressor running on ep.io as smooth as possible. Install django-compressor (add it to your requirements file that is) according to the docs. Add this snippet to you epio.ini, this is to make a symlink to your /media, since this is the only place you can write to on ep.io, and django-compressor can only write to the same place it reads from. [symlinks] static/CACHE = ../data/CACHE I never got STATIC_URL... -
Using django-compressor on ep.io
This is a small tip to how to get django-compressor running on ep.io as smooth as possible. Install django-compressor (add it to your requirements file that is) according to the docs. Add this snippet to you epio.ini, this is to make a symlink to your /media, since this is the only place you can write to on ep.io, and django-compressor can only write to the same place it reads from. [symlinks] static/CACHE = ../data/CACHE I never got STATIC_URL... -
Django app name translation in admin
Motivation for writing this application is that some website editors became confused with mix of english and localized content in Django administration pages. All existing solutions I found involved patching django itself or changing app labels which was problematic for lot of reasons. Hopefully, this application would become excessive, once when patch from Ticket #3591 find it’s way to Django. You can find Django app name translation in admin application on Github -
Configuring a Jenkins Slave
We're pretty avid testers here at Caktus and when one of our Django projects required upgrading to Python 2.7, we also needed to upgrade our Jenkins build environment. Luckily, Jenkins supports distributed builds to allow a master install to delegate tasks to slaves instances. This way we can continue to run our primary build system ... -
Configuring a Jenkins Slave
We're pretty avid testers here at Caktus and when one of our Django projects required upgrading to Python 2.7, we also needed to upgrade our Jenkins build environment. Luckily, Jenkins supports distributed builds to allow a master install to delegate tasks to slaves instances. This way we can continue to run our primary build system ... -
Configuring a Jenkins Slave
We're pretty avid testers here at Caktus and when one of our Django projects required upgrading to Python 2.7, we also needed to upgrade our Jenkins build environment. Luckily, Jenkins supports distributed builds to allow a master install to delegate tasks to slaves instances. This way we can continue to run our primary build system ... -
[Django Day] - Aperta la CFP
[Django Day] - Aperta la CFP Il gruppo WEBdeBS (Web Developer Bresciani), in collaborazione con l’associazione Python Italia, sta organizzando il primo Django Day a livello nazionale. La conferenza si terrà a Brescia il 28 Aprile 2012. E’ ufficialmente aperta la Call For Paper: Le conferenze WEBdeBS si contraddistinguono nell’affrontare esperienze reali tramite il cosiddetto approccio for real: “poche chiacchere e tanta ciccia”. Nei talk del Django Day vorremmo sentir parlare e discutere di scenari concreti, casi di successo, “common pitfalls”, “ best practices”, strumenti/tools particolari a corredo, “batteries” utilizzate, cioè tutto ciò che circonda l’ecosistema Django. Se vuoi raccontare la tua esperienza questa è un’occasione buona per farlo: fino al 10 marzo è possibile inviare proposte di talk e speech sull'argomento Django, scrivendo a cfp@djangoday.it e indicando titolo e abstract del talk che vorresti portare, il tuo nome e cognome e i tuoi riferimenti "social" (Twitter, LinkedIn, Skype): verrai ricontattato dallo staff appena possibile. Ricorda: la CFP chiude il 10 marzo. Per sapere quando verrano aperte le iscrizioni, ricevere novità sull’evento, iscriviti alla newsletter e seguici su twitter @djangoday e @webdebresa. Per qualsiasi contatto diretto non esitare a scriverci a info@djangoday.it Vuoi diventare sponsor del Django Day? WEBdeBS ha alle … -
[Django Day] - Aperta la CFP
[Django Day] - Aperta la CFP body,.backgroundTable{ background-color:#eeeeee; } #contentTable{ border:0px none #000000; margin-top:10px; } .headerTop{ background-color:#0B2226; border-top:1px none #000000; border-bottom:0px none #000000; text-align:right; padding:0px; } .adminText{ font-size:10px; color:#407F6A; line-height:200%; font-family:Helvetica; text-decoration:none; } .headerBar{ background-color:#1F4C4A; border-top:0px none #333333; border-bottom:0px none #FFFFFF; padding:0px; } .headerBarText{ color:#333333; font-size:30px; font-family:Helvetica; font-weight:normal; text-align:left; } .postcardBarText{ color:#333333; font-size:9px; font-family:Helvetica; font-weight:normal; text-align:center; } .title{ font-size:24px; font-weight:bold; color:#407F6A; font-family:Helvetica; line-height:150%; } .subTitle{ font-size:14px; font-weight:bold; color:#000000; font-style:normal; font-family:Helvetica; } .defaultText{ font-size:12px; color:#333333; line-height:150%; font-family:Helvetica; background-color:#FFFFFF; padding:20px; border:0px none #FFFFFF; } .footerRow{ background-color:#0B2226; border-top:1px solid #000000; padding:20px; } .footerText{ font-size:10px; color:#1F4C4A; line-height:100%; font-family:Helvetica; } a,a:link,a:visited{ color:#17488a; text-decoration:underline; font-weight:normal; } .headerTop a{ color:#407F6A; text-decoration:none; font-weight:normal; } .footerRow a{ color:#407F6A; text-decoration:none; font-weight:normal; } body,.backgroundTable{ background-color:#0B2226; } a,a:link,a:visited{ color:#407F6A; } #templateHeader{ padding:0px; background-color:#304948; } Il gruppo WEBdeBS (Web Developer Bresciani), in collaborazione con l’associazione Python Italia, sta organizzando il primo Django Day a livello nazionale. La conferenza si terrà a Brescia il 28 Aprile 2012. E’ ufficialmente aperta la Call For Paper: Le conferenze WEBdeBS si contraddistinguono nell’affrontare esperienze reali tramite il cosiddetto approccio for real: “poche chiacchere e tanta ciccia”. Nei talk del Django Day vorremmo sentir parlare e discutere di scenari concreti, casi di successo, “common pitfalls”, “ best practices”, … -
Release 0.6.4
We just released LFS 0.6.4. This is a yet another bugfix release. Changes Bugfix: fixed price calculation of configurable products. News: We have setup a GitHub mirror of LFS. The docs are running on our own domain now (still hosted on RTD) and have a new layout: http://docs.getlfs.com/ Information You can find more information and help on following locations: Documentation on PyPI Demo Releases on PyPI Source code on bitbucket.org and github. Google Group lfsproject on Twitter IRC -
Scary monsters and feature-creep
Scary monsters and feature-creep -
Einladung zur Django-UserGroup Hamburg am 11. Januar
Das nächste Treffen der Django-UserGroup Hamburg findet am Mittwoch, den 11.01.2012 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 (Anfahrtsbeschreibung auf Google Maps). Bitte am Eingang 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. Neben Projektvorstellungen werden dieses mal sicher auch die Neuerungen in Django 1.4 ein Thema sein. Die meisten Vorträge ergeben sich erfahrungsgemäß vor Ort. Als kleine Besonderheit wird bei diesem Treffen unter allen Teilnehmern eine Lizenz für PyCharm verlost, die uns der Hersteller JetBrains zur Verfügung stellt. Eingeladen ist wie immer jeder der Interesse hat sich mit anderen Djangonauten auszutauschen. Eine Anmeldung ist nicht erforderlich, aber hilfreich für die Planung: Doodle Kaldender. Weitere Informationen über die UserGroup gibt auf unserer Webseite www.dughh.de. -
Django Site Login Script
Just having a play around with a Python script that will login to a standard Django login form. I thought I’d share it as it’s quite interesting and I’m sure someone might find a use for it. It uses the standard Python modules urllib2, urllib and cookielib. It also requires BeautifulSoup for getting the generated CSRF [...] -
DjangoRedmineAdmin 1.0 released
I recently needed (again) to ‘browse’ a redmine database, and I used my DjangoRedmineAdmin application to do so. I took this opportunity to update the code and doing some more tests/fixes. As a result I decided to tag this as 1.0. The main modifications are: updated to comply with current redmine version (1.2.1 and 1.3.0) [...] -
Timing AMO user experience
There are lots of ways to measure the performance of a site. On addons.mozilla.org we measure a few of them: how long it takes to render pages, the cache performance and responsiveness for content delivery networks globally. But with the advent of the navigation timing API in Firefox 7 we’ve been able to add the [...] -
Timing AMO user experience
There are lots of ways to measure the performance of a site. On addons.mozilla.org we measure a few of them: how long it takes to render pages, the cache performance and responsiveness for content delivery networks globally. But with the advent of the navigation timing API in Firefox 7 we’ve been able to add the most important measurement of all – the actual performance in the browser. Along with a few other Mozilla sites, we’ve been using pystatsd and Graphite for a while. This produces useful graphs of the site health and performance. For example, this graph plots HTTP responses we serve out from Python (this is not the amount of traffic to our site which is much larger). To facilitate using the timing API we wrote a module between statsd and Django called django-statsd that, amongst other things, provides a way to interface between the browser and Python backend. The library has support for boomerang, a great front end timing library. I quickly wrote a much simpler service called stick, which sends a small subset of timings that we want. Using stick is straightforward – once you’ve setup your Python backed and included your JavaScript, you call it in … -
Extending User Model in Django
When building nearly every application in Django there comes a time where you want to associate more information with a user then just the built in ones. Django lets you as the programmer control how and where you want to handle this information. There are several ways to do this, and there is no absolute right or wrong way. This is just one way to manage extra user data and we find it very easy to use and manage. First we create a user profile model (Like to create a separate ”accounts” app to house this data). from django.contrib.auth.models import User from django.db.models.signals import post_save class UserProfile(models.Model): user = models.OneToOneField(User) #other fields here def __str__(self): return "%s's profile" % self.user def create_user_profile(sender, instance, created, **kwargs): if created: profile, created = UserProfile.objects.get_or_create(user=instance) post_save.connect(create_user_profile, sender=User) User.profile = property(lambda u: u.get_profile() ) As you can see above is a normal model with a foreign key to the Django User model. Then add any other fields you would want to store for a user: date of birth, website, favorate color, or whatever. Then we are going to tie a signal to the creation of users. In this case we use the django post_save signal … -
The Django gunicorn fabfile project
Since I read about Green Unicorn, better known as gunicorn, a Python WSGI HTTP server that goes along very well with Django, I knew I had to try it, and trying it I did. And I liked it. There were many steps to make a server work but overall it was cleaner than other approaches, including the Django deployment using Nginx, Apache and mod_wsgi that I described long time ago. And many reports indicate that a Django setup with gunicorn performs better than one using Apache. But when you have to setup many servers with the same configuration, the process gets boring and repetitive, and when you're bored you make mistakes. This is the perfect scenario for automating with Python and a Fabric script. I wanted the initial version of my fabfile to do the following: Start with a clean install of Ubuntu 11.10, just with an openssh-server running. Install all the Ubuntu packages needed for running a basic Django site, these include Nginx, virtualenv, some Python development tools, and PostgreSQL. Create virtual environments and manage them with virtualenvwrapper. Install a few Python packages in the virtual environments: Django, gunicorn, iptyhon, psycopg2, to name a few. Create the configuration files … -
Using Signals in your Django App
Yesterday, I posted a fairly popular post (for my blog anyway) dealing with how I write reusable Django apps. There were a couple of comments on Hacker News asking for some more details about some of thing suggestions mentioned in my post. Therefore, I'd like to start by digging into the use of signals to provide better site level integration. What is a signal anyway? A signal is defined by the Django documentation as: “Django includes a “signal dispatcher” which helps allow decoupled applications get notified when actions occur elsewhere in the framework. In a nutshell, signals allow certain senders to notify a set of receivers that some action has taken place.” A good example to highlight this is a recent upgrade I made to biblion which is the blog app that I use to drive this site. After my previous article was getting hammered from being on page 1 of HackerNews for an extended period of time, I noticed the page response times were starting to suffer. I took a more careful look at the detail view serving up the page and discovered it was calling post.inc_views() which would be making an update to a count on the row …