Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
To my friends in the Node community
Dear friends in the Node community, I’m excited and inspired by the work that you’re doing. Being new is exciting: you get to re-invent the world, and shape it to suit your purposes. You’re not bound by the mistakes other environments have accrued over the years. This has paid huge dividends. You’ve come up with a way to make asynchronous programming accessible to a much wider pool of programmers. You’re creating a set of tools that put developer experience first, proving that developer tools don’t have to have terrible user interfaces. -
Out-of-band mergings
As of today the development repository of Evennia, which has been brewing for a few months now, merged into the main repository. This update grew from one experimental feature to a relatively big update in the end. Together with the "many-character-per-player" feature released earlier, this update covers all the stuff I talked about in my Behind the Scenes blog post. Evennia's webserver was moved from Portal to Server. This moves all database-modifying operations into the same process and neatly avoids race conditions when modifying a game world from various interfaces. The OOB (Out Of Band) handler was implemented. This goes together with a protocol for telnet sub-negotiations according to the MSDP specification. The handler allows on-demand reporting whenever database fields update. It also offers regular polling of properties if needed. A user can customize which oob commands are available to the client and write whatever handlers are needed for their particular game. In the future we'll also add support for GMCP, but the lack of a central, official specification is off-putting (if there is a central document besides accounts of how individual games chose to implement GMCP, please let me know). For our own included web client, we'll likely just use … -
Be More Productive with django_extensions
Django provides a lot of really useful things by default, but there are a few things we do over and over again. Learn how django extensions help solve some of these, and enhances your ability to do others with this intro to django-extensions. We will show a few of the many many useful things it can do.Watch Now... -
Welcome to the world, Wish List Granted
I built something. It's called Wish List Granted. It's a mash-up using Amazon.com's Wish List functionality. What you do is you hook up your Amazon wish list onto wishlistgranted.com and pick one item. Then you share that page with friends and familiy and they can then contribute a small amount each. When the full amount is reached, Wish List Granted will purchase the item and send it to you. The Rules page has more details if you're interested. The problem it tries to solve is that you have friends would want something and even if it's a good friend you might be hesitant to spend $50 on a gift to them. I'm sure you can afford it but if you have many friends it gets unpractical. However, spending $5 is another matter. Hopefully Wish List Granted solves that problem. Wish List Granted started as one of those insomnia late-night project. I first wrote a scraper using pyQuery then a couple of Django models and views and then tied it up by integrating Balanced Payments. It was actually working on the first night. Flawed but working start to finish. When it all started, I used Persona to require people to authenticate … -
New Apps & Migrations
This week, it's the exciting story of one man's battle against his idea of automatically writing settings files. One of the early questions I ran into when designing migrations was how to make the onboarding experience for users as easy as possible. All new apps that you made in 1.7 should come with migrations from the start, of course, but we didn't want to automatically convert apps that didn't have migrations - those could be third-party apps or, as I found to my amusement during initial testing, django.contrib apps. Several potential solutions were thought of and discussed between some of the core team and some South users I talk to regularly. The first thought was a new setting - perhaps MIGRATED_APPS - that defined which apps had migrations, but this was a bad idea and required people to opt-in - a definite no-no. The second idea was to automatically exclude django.contrib apps and then have a blacklist setting - UNMIGRATED_APPS. As we're trying not to introduce more settings in Django, this wasn't looking great from the start, and this still needed makemigrations to prompt you for every new app and ask if you wanted migrations - asking every time if … -
Hiring a Python web application developer
My client is looking to hire a new Python developer, initially for an 8 month contract. It's a home working position, we communicate mostly via Skype / email / gtalk etc. Although we do meet up in meatspace from time to time, so ideally a candidate would be in the London / Oxford area. You will be working with your truly. The projects I've been working on are in the server side of web-enabled devices. The web interface is written in Django, so you'll need the usual battery of front-end technologies; HTML, CSS, Javascript etc. We have a Twistd server which communicates with devices in the field, that my client produces. In the middle we have dynamic user interface generation from XML. So there is some genuinely interesting technology there, and more such projects planned. We need someone who is a good problem solver with a general interest in web technologies. There's also the occasionally need work with data at the bits and bytes level, so a working knowledge of C that would be a plus. See the Careers page on wildfoundry.com for the full details. -
Hiring a Python web application developer
My client is looking to hire a new Python developer, initially for an 8 month contract. It's a home working position, we communicate mostly via Skype / email / gtalk etc. Although we do meet up in meatspace from time to time, so ideally a candidate would be in the London / Oxford area. You will be working with your truly. The projects I've been working on are in the server side of web-enabled devices. The web interface is written in Django, so you'll need the usual battery of front-end technologies; HTML, CSS, Javascript etc. We have a Twistd server which communicates with devices in the field, that my client produces. In the middle we have dynamic user interface generation from XML. So there is some genuinely interesting technology there, and more such projects planned. We need someone who is a good problem solver with a general interest in web technologies. There's also the occasionally need work with data at the bits and bytes level, so a working knowledge of C that would be a plus. See the Careers page on wildfoundry.com for the full details. -
Hiring a Python web application developer
My client is looking to hire a new Python developer, initially for an 8 month contract. It's a home working position, we communicate mostly via Skype / email / gtalk etc. Although we do meet up in meatspace from time to time, so ideally a candidate would be in the London / Oxford area. You will be working with your truly. The projects I've been working on are in the server side of web-enabled devices. The web interface is written in Django, so you'll need the usual battery of front-end technologies; HTML, CSS, Javascript etc. We have a Twistd server which communicates with devices in the field, that my client produces. In the middle we have dynamic user interface generation from XML. So there is some genuinely interesting technology there, and more such projects planned. We need someone who is a good problem solver with a general interest in web technologies. There's also the occasionally need work with data at the bits and bytes level, so a working knowledge of C that would be a plus. See the Careers page on wildfoundry.com for the full details. -
Finding the first bit set with Python
Here's a Python gotcha that I spent some time tracking down. I'm writing it up in the spirit of saving developers a debugging headache in the future. I had an integer with a single bit set, and I wanted to find the index of that bit. For example, 4 in binary is 00000100. The 1 is at the third position from the right, which should give an index of 2 – since the first position is 0. You can do this in two ways; either check each bit in turn until you find a 1, or you can use math as a shortcut. I chose the math solution: >>> import math >>> myint = 4 >>> int(math.log(myint, 2)) 2 Simple right? Finally staying awake in high school maths paid off. So simple that it was the last bit of code I suspected to be broken (spoiler: it was). This is Python 2.7 which still has two types of integer; type int and arbitrary long integer type long. I was testing with ints because that's what you get when you type 4. However the numbers I was getting out of the Django db where longs. Look what happens with the above … -
Finding the first bit set with Python
Here's a Python gotcha that I spent some time tracking down. I'm writing it up in the spirit of saving developers a debugging headache in the future. I had an integer with a single bit set, and I wanted to find the index of that bit. For example, 4 in binary is 00000100. The 1 is at the third position from the right, which should give an index of 2 – since the first position is 0. You can do this in two ways; either check each bit in turn until you find a 1, or you can use math as a shortcut. I chose the math solution: >>> import math >>> myint = 4 >>> int(math.log(myint, 2)) 2 Simple right? Finally staying awake in high school maths paid off. So simple that it was the last bit of code I suspected to be broken (spoiler: it was). This is Python 2.7 which still has two types of integer; type int and arbitrary long integer type long. I was testing with ints because that's what you get when you type 4. However the numbers I was getting out of the Django db where longs. Look what happens with the above … -
Finding the first bit set with Python
Here's a Python gotcha that I spent some time tracking down. I'm writing it up in the spirit of saving developers a debugging headache in the future. I had an integer with a single bit set, and I wanted to find the index of that bit. For example, 4 in binary is 00000100. The 1 is at the third position from the right, which should give an index of 2 – since the first position is 0. You can do this in two ways; either check each bit in turn until you find a 1, or you can use math as a shortcut. I chose the math solution: >>> import math >>> myint = 4 >>> int(math.log(myint, 2)) 2 Simple right? Finally staying awake in high school maths paid off. So simple that it was the last bit of code I suspected to be broken (spoiler: it was). This is Python 2.7 which still has two types of integer; type int and arbitrary long integer type long. I was testing with ints because that's what you get when you type 4. However the numbers I was getting out of the Django db where longs. Look what happens with the above … -
Long-term reliability test with Django
Steel rusts. Food rots. And WordPress? Well, really bad things tend to happen when it's left unattended. But this website, built by hand using Django, has held up remarkably well over time. A little history: I built this site a few years ago when Lindsay and I lived in Knoxville, TN. I was working for the E.W. Scripps company at the time, and had a full-on love affair with Django (I still do). I started working at Scripps at the beginning of the first enterprise rollout of a Django content management system (customized version of Ellington. I was not new to Django then; I began using the framework toward the end of our first stay in Roanoke. This blog was both a way for me to keep my writing chops pliable, but also to put into practice the code used by Scripps developers. It helped me understand what they were building, and apply that knowledge to my role as project manager. As new versions of Django came out, so did this blog. I stopped updating around version 1.2.3 however. But unlike a WordPress install, this app has continued to hum along dutifully. This isn't to say I recommend building apps … -
Long-term reliability test with Django
Steel rusts. Food rots. And WordPress? Well, really bad things tend to happen when it's left unattended. But this website, built by hand using Django, has held up remarkably well over time. A little history: I built this site a few years ago when Lindsay and I lived in Knoxville, TN. I was working for the E.W. Scripps company at the time, and had a full-on love affair with Django (I still do). I started working at Scripps at the beginning of the first enterprise rollout of a Django content management system (customized version of Ellington. I was not new to Django then; I began using the framework toward the end of our first stay in Roanoke. This blog was both a way for me to keep my writing chops pliable, but also to put into practice the code used by Scripps developers. It helped me understand what they were building, and apply that knowledge to my role as project manager. As new versions of Django came out, so did this blog. I stopped updating around version 1.2.3 however. But unlike a WordPress install, this app has continued to hum along dutifully. This isn't to say I recommend building apps … -
Happy Holidays from Daniel and Audrey
The Python community has been like our family. We met through the community, and many of our dearest friendships started because of the community. This year has been a very special year for us. We wrote Two Scoops of Django, and we started a little publishing company called Two Scoops Press. We traveled throughout Spain, Poland, Italy, and Croatia, teaching and helping local user groups. Daniel gave keynote speeches at DjangoCon Europe and EuroPython. We did a few book signings and got the chance to meet many of our book's readers. Now we are back in Southern California, settling into our new home together and getting ready to release the next edition of our first book. We couldn't have gotten to this point without you, our friends and readers. It is because of your feedback that we've been able to improve the next edition. We've been hard at work expanding chapters and sections that you wanted to hear more about. We've been making little changes everywhere to improve clarity and help you see what's in our heads. We've been scrubbing those typos. Audrey has been drinking lots of coffee and drawing more silly Django ice cream metaphor cartoons. Daniel has … -
Happy Holidays from Daniel and Audrey
The Python community has been like our family. We met through the community, and many of our dearest friendships started because of the community. This year has been a very special year for us. We wrote Two Scoops of Django, and we started a little publishing company called Two Scoops Press. We traveled throughout Spain, Poland, Italy, and Croatia, teaching and helping local user groups. Daniel gave keynote speeches at DjangoCon Europe and EuroPython. We did a few book signings and got the chance to meet many of our book's readers. Now we are back in Southern California, settling into our new home together and getting ready to release the next edition of our first book. We couldn't have gotten to this point without you, our friends and readers. It is because of your feedback that we've been able to improve the next edition. We've been hard at work expanding chapters and sections that you wanted to hear more about. We've been making little changes everywhere to improve clarity and help you see what's in our heads. We've been scrubbing those typos. Audrey has been drinking lots of coffee and drawing more silly Django ice cream metaphor cartoons. Daniel has … -
Happy Holidays from Daniel and Audrey
The Python community has been like our family. We met through the community, and many of our dearest friendships started because of the community. This year has been a very special year for us. We wrote Two Scoops of Django, and we started a little publishing company called Two Scoops Press. We traveled throughout Spain, Poland, Italy, and Croatia, teaching and helping local user groups. Daniel gave keynote speeches at DjangoCon Europe and EuroPython. We did a few book signings and got the chance to meet many of our book's readers. Now we are back in Southern California, settling into our new home together and getting ready to release the next edition of our first book. We couldn't have gotten to this point without you, our friends and readers. It is because of your feedback that we've been able to improve the next edition. We've been hard at work expanding chapters and sections that you wanted to hear more about. We've been making little changes everywhere to improve clarity and help you see what's in our heads. We've been scrubbing those typos. Audrey has been drinking lots of coffee and drawing more silly Django ice cream metaphor cartoons. Daniel has … -
Wordpress NextGEN gallery and "Not a valid template"
If you encounter the output [Not a valid template] on your gallery pages after you updated to NextGEN gallery 2.x and you probably moved your blog location on the server, then you should check the plugin settings. In my case, under NextGEN Basic Thumbnails the Template value pointed to a wrong path. After I fixed that, everything worked again: -
Wordpress NextGEN gallery and "Not a valid template"
If you encounter the output [Not a valid template] on your gallery pages after you updated to NextGEN gallery 2.x and you probably moved your blog location on the server, then you should check the plugin settings. In my case, under NextGEN Basic Thumbnails the Template value pointed to a wrong path. After I fixed that, everything worked again: -
Wordpress NextGEN gallery and "Not a valid template"
If you encounter the output [Not a valid template] on your gallery pages after you updated to NextGEN gallery 2.x and you probably moved your blog location on the server, then you should check the plugin settings. In my case, under NextGEN Basic Thumbnails the Template value pointed to a wrong path. After I fixed that, everything worked again: -
Automated creation of self signed SSL certificate
For developing websites with SSL on your local computer there is the need to create a self signed SSL certificate. As I often need this, I wrote this little script. You may adjust the -subj part in line 4: #!/bin/bash password="password" sudo openssl genrsa -passout pass:$password -des3 -out $1.key 1024 sudo openssl req -new -passin pass:$password -subj "/C=DE/ST=Saxony/L=Dresden/CN=$1" -key $1.key -out $1.csr sudo openssl rsa -passin pass:$password -in $1.key -out $1.key sudo openssl x509 -req -days 365 -in $1.csr -signkey $1.key -out $1.crt Usage: ./create_self_signed_ssl.sh mydomain.local -
Automated creation of self signed SSL certificate
For developing websites with SSL on your local computer there is the need to create a self signed SSL certificate. As I often need this, I wrote this little script. You may adjust the -subj part in line 4: #!/bin/bash password="password" sudo openssl genrsa -passout pass:$password -des3 -out $1.key 1024 sudo openssl req -new -passin pass:$password -subj "/C=DE/ST=Saxony/L=Dresden/CN=$1" -key $1.key -out $1.csr sudo openssl rsa -passin pass:$password -in $1.key -out $1.key sudo openssl x509 -req -days 365 -in $1.csr -signkey $1.key -out $1.crt Usage: ./create_self_signed_ssl.sh mydomain.local -
Automated creation of self signed SSL certificate
For developing websites with SSL on your local computer there is the need to create a self signed SSL certificate. As I often need this, I wrote this little script. You may adjust the -subj part in line 4: #!/bin/bash password="password" sudo openssl genrsa -passout pass:$password -des3 -out $1.key 1024 sudo openssl req -new -passin pass:$password -subj "/C=DE/ST=Saxony/L=Dresden/CN=$1" -key $1.key -out $1.csr sudo openssl rsa -passin pass:$password -in $1.key -out $1.key sudo openssl x509 -req -days 365 -in $1.csr -signkey $1.key -out $1.crt Usage: ./create_self_signed_ssl.sh mydomain.local -
"djpeewee": use the peewee ORM with your Django models
I sat down and started working on a new library shortly after posting about Django's missing API for generating SQL. djpeewee is the result, and provides a simple translate() function that will recursively translate a Django model graph into a set of "peewee equivalents". The peewee versions can then be used to construct queries which can be passed back into Django as a "raw query". Here are a couple scenarios when this might be useful: Joining on fields that are not related by foreign key (for example UUID fields). Performing filters on calculated values. Performing aggregate queries on calculated values. Using SQL statements that Django does not support such as CASE. Utilizing SQL functions that Django does not support, such as SUBSTR. Replacing nearly-identical SQL queries with reusable, composable data-structures. I've included this module in peewee's playhouse, which is bundled with peewee. Code samples Suppose we have an Event model and want to find all events in the database that are longer than 2 hours: syntax:python class Event(models.Model): start = models.DateTimeField() end = models.DateTimeField() title = models.CharField(max_length=50) two_hours = datetime.timedelta(hours=2) Event.objects.filter(???) With Django I believe you would have to use the extra() method. Edit: a helpful redditor pointed out this … -
A Django base class for all your Forms
This has served me well of the last couple of years of using Django: from django import forms class _BaseForm(object): def clean(self): cleaned_data = super(_BaseForm, self).clean() for field in cleaned_data: if isinstance(cleaned_data[field], basestring): cleaned_data[field] = ( cleaned_data[field].replace('\r\n', '\n') .replace(u'\u2018', "'").replace(u'\u2019', "'").strip()) return cleaned_data class BaseModelForm(_BaseForm, forms.ModelForm): pass class BaseForm(_BaseForm, forms.Form): pass So instead of doing... class SigupForm(forms.Form): name = forms.CharField(max_length=100) nick_name = forms.CharField(max_length=100, required=False) ...you do: class SigupForm(BaseForm): name = forms.CharField(max_length=100) nick_name = forms.CharField(max_length=100, required=False) What it does is that it makes sure that any form field that takes a string strips all preceeding and trailing whitespace. It also replaces the strange "curved" apostrophe ticks that Microsoft Windows sometimes uses. Yes, this might all seem trivial and I'm sure there's something as good or better out there but isn't it a nice thing to never have to worry about doing things like this again: class SignupForm(forms.Form): ... def clean_name(self): return self.cleaned_data['name'].strip() #...or... form = SignupForm(request.POST) if form.is_valid(): name = form.cleaned_data['name'].strip() -
Transform Images with django-imagekit
In this video we will walk through a couple of easy ways to transform images as you need them. django-imagekit makes this fairly simple and straight forward. This video provides an introduction to using it.Watch Now...