Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Sharing Your Labor of Love: PyPI Quick and Dirty
A completely incomplete guide to packaging a Python module and sharing it with the world on PyPI. Abstract Few things give me caremads like Python modules I want to use that aren’t on PyPI (pronounced “pie pee eye”, or “cheese shop”, not “pie pie”!). On the other hand – as pydanny points out – the current situation on packaging is rather confusing. Therefore I want to help everyone who has some great code but feels lost with getting it on PyPI. I will be using my latest opus “pem” as a realistic yet simple example of how to get a pure-Python 2 and 3 module packaged up, tested and uploaded to PyPI. Including the new and shiny binary wheel format that’s faster and allows for binary extensions (read the wheel story if you want to know more and watch the list at Python Wheels get greener and greener)! I’ll keep it super simple to get everyone started. At the end, I’ll link more complete documentation to show you the way ahead. Sorry, no Windows. Tools Used This is not a history lesson, therefore we will use: pip 1.4+ (if you have no pip yet, bootstrapping is easy), setuptools 0.9+, and … -
Django Single Table Inheritance on the cheap.
There was a recent question on Stack Overflow about Django Single Table Inheritance (STI). It got me thinking about how to use my FSM-proxy stuff to just be about STI. Note: this only works when all sub-classes have the same fields: the example we are going to use here is different to a state machine, in that an object may not change state after it has been created. {% highlight python %} class Sheep(models.Model): type = models.CharField(max_length=4) tag_number = models.CharField(max_length=64) class Ram(Sheep): class Meta: proxy = True class Ewe(Sheep): class Meta: proxy = True {% endhighlight %} In this case, we can fetch all sheep as ``Sheep.objects.all()``. However, this gives us the objects as ``Sheep`` instances, when we want those with `type='ram'` to return `Ram` instances, and those with `type='ewe'` to return `Ewe` instances. We can do this, by the magic of ``type().__subclasses__()``. {% highlight python %} class Sheep(models.Model): # fields as above def __init__(self, *args, **kwargs): super(Sheep, self).__init__(*args, **kwargs) # If we don't have a subclass at all, then we need the type attribute to match # our current class. if not self.__class__.__subclasses__(): self.type = self.__class__.__name__.lower() else: subclass = [x for x in self.__class__.__subclasses__() if x.__name__.lower() == self.type] if … -
Made Up Statistics
Years ago my good friend Miguel Araujo and I presented on Advanced Django Form Usage. Slide 18 of that talk mentioned some made up statistics. Here they are for reference: 91% of Django projects use ModelForms. 80% ModelForms require trivial logic. 20% ModelForms require complex logic. In Chapter 10 of Two Scoops of Django I expanded on those made up statistics: 95% of Django projects should use ModelForms. 91% of all Django projects use ModelForms. 80% of ModelForms require trivial logic. 20% of ModelForms require complicated logic. Important Disclaimer: These numbers were cooked out of thin air by yours truly. I determined them with zero research, they carry absolutely no scientific weight, and shouldn't be used in any serious argument. They are wholly my opinion, which is good or bad depending on your point of view and your own opinion of my opinions. With that out of the way, I've made a bar graph out of my fictional data: You'll notice that my bar titles could be stronger. I actually did that on purpose in case anyone tries to use that chart in real life. In any case, if you thought that was interesting, then read on. I have many … -
Made Up Statistics
Years ago my good friend Miguel Araujo and I presented on Advanced Django Form Usage. Slide 18 of that talk mentioned some made up statistics. Here they are for reference: 91% of Django projects use ModelForms. 80% ModelForms require trivial logic. 20% ModelForms require complex logic. In Chapter 10 of Two Scoops of Django I expanded on those made up statistics: 95% of Django projects should use ModelForms. 91% of all Django projects use ModelForms. 80% of ModelForms require trivial logic. 20% of ModelForms require complicated logic. Important Disclaimer: These numbers were cooked out of thin air by yours truly. I determined them with zero research, they carry absolutely no scientific weight, and shouldn't be used in any serious argument. They are wholly my opinion, which is good or bad depending on your point of view and your own opinion of my opinions. With that out of the way, here's a bar graph created from the fictional data I presented with Miguel back in 2011: You'll notice that my bar titles could be stronger. I actually did that on purpose in case anyone tries to use that chart in real life. In any case, if you thought that was interesting, … -
Travis-CI and Coveralls
Continuous Integration and Code Coverage used to be hard. Now with Travis-CI and Coveralls life just got a lot easier, especially for open source projects. In this video we will go over setting up travis and coveralls for django applications.Watch Now... -
django-getenv – use environment variables in your Django settings
So I made a thing for using environment variables within your Django settings: django-getenv. Although the code itself is trivial (and, to be honest, not coupled with Django in any way), because I was re-using the same code in multiple projects I decided – if only to make my life easier – to made it into a standalone module and package. Enough of the what, let us get onto the why. I’m a big fan of The Twelve-Factor App, and although I can’t or don’t always follow its tenets in every app I write, I do my best. One of the tenets is “Store config in the environment”: The twelve-factor app stores config in environment variables (often shortened to env vars or env). Env vars are easy to change between deploys without changing any code; unlike config files, there is little chance of them being checked into the code repo accidentally; and unlike custom config files, or other config mechanisms such as Java System Properties, they are a language- and OS-agnostic standard. Although Django has a range of configuration options, it does not lend itself well to using environment variables out of the box. Jacob Kaplan-Moss has addressed part of … -
Becoming a Django Apologist
It's been roughly four years since my introduction to the Django framework and I thought I'd write a little post to commemorate this. In my mind nothing had as big an impact on my career as my decision to work at the Journal World. When I started there I knew basically nothing about software engineering or open-source, and it is entirely thanks to my excellent (and patient) coworkers there that I was able to learn about these things. -
Going Responsive
I was somewhat skeptical of responsive design. Grids add some additional HTML which is essentially for layout and I thought responsive design generally relied on Javascript, but after transforming my own website I found things are getting better. Let's start with what my website used to look like. Boxy and segmented, it was built for a specific width and not on a grid. It looked alright on mobile because I used the meta viewport element correctly. For the redesign I used bootstrap with its responsive grid and font awesome, which is as awesome as the name implies. Gone were the boxes, replaced with infinitely wide horizontal stripes and content suspended on an invisible grid. A grid which can resize its cells and stack them all vertically when down at a phone resolution — thanks to everything floating left. My cat-based banner image previously was precisely cropped, but that wasn't going to work in a world where everything is infinitely wide. I went with the common approach of making the picture of my cat full width and centred, keeping the most interesting part of the picture in the middle of the viewport. I had to tweak the media queries in the … -
New Podcast: Django Roundup
The team over at Lincoln Loop have just started a new Django podcast - and their very first item in podcast #1 was a nice little review of django-readonly-site! -
New Podcast: Django Roundup
The team over at Lincoln Loop have just started a new Django podcast - and their very first item in podcast #1 was a nice little review of django-readonly-site! -
New Podcast - Django Roundup
Lincoln Loop are one of the earlier Django-based development shops, and their various employees contribute in many ways to the open-source community. One new addition they've just made is the launch of Django Round-Up, a podcast covering the news in the Django community. This is a podcast hosted by @kennethlove and @bkonkle from @lincolnloop that highlights recent articles and projects in the Django community. We love talking about web development, so our podcast focuses on casual conversations as we cover the latest blog posts and project releases. I was surprised to hear my name coming through my headphones, only a minute into their first episode - with a quick review of my recently-published django-readonly-site package. As a result of their comments I've made some minor updates to address questions and suggestions from the podcast team. I want to publicly thank them for including my item in their inaugural episode, and suggest that anybody in the Django community goes out and checks out this valuable new resource! -
New Podcast - Django Roundup
Lincoln Loop are one of the earlier Django-based development shops, and their various employees contribute in many ways to the open-source community. One new addition they've just made is the launch of Django Round-Up, a podcast covering the news in the Django community. This is a podcast hosted by @kennethlove … -
New Podcast: Django Roundup
Lincoln Loop are one of the earlier Django-based development shops, and their various employees contribute in many ways to the open-source community. One new addition they've just made is the launch of Django Round-Up, a podcast covering the news in the Django community. This is a podcast hosted by @kennethlove and @bkonkle from @lincolnloop that highlights recent articles and projects in the Django community. We love talking about web development, so our podcast focuses on casual conversations as we cover the latest blog posts and project releases. I was surprised to hear my name coming through my headphones, only a minute into their first episode - with a quick review of my recently-published django-readonly-site package. As a result of their comments I've made some minor updates to address questions and suggestions from the podcast team. I want to publicly thank them for including my item in their inaugural episode, and suggest that anybody in the Django community goes out and checks out this valuable new resource! -
Travel Tips for Geeks: Preventing Theft
This is the first in a set of blog posts based on my experiences traveling in various places around the world. This particular safety-related post is about theft, not scams, which I may cover in another article. For this first article, I'm hoping this gets on various technical RSS feeds. I'm doing this because many of the readers of such feeds attend conferences and are strangers in far and distant places. About Thieves Thieves (or pick pockets) are everywhere. I've seen extremely suspicious activity in Portland, Los Angeles, Washington DC, Barcelona, Florence, Pisa, and Krakow. Years ago in Washington DC I had stuff stolen from me twice so I've been observant and careful ever since. Anywhere there are non-residents distracted by looking at new vistas while suffering from travel fatigue is where most thieves can be found. I've learned a lot by observation and doing research but I don't claim to be an expert. All I claim to be is someone who doesn't want to be ripped off far from home. The Basics: Any place with tourists is risky While it can be said that thieves can be anywhere, the truth is that they focus on where the tourists go. … -
Travel Tips for Geeks: Preventing Theft
This is the first in a set of blog posts based on my experiences traveling in various places around the world. This particular safety-related post is about theft, not scams, which I may cover in another article. For this first article, I'm hoping this gets on various technical RSS feeds. I'm doing this because many of the readers of such feeds attend conferences and are strangers in far and distant places. About Thieves Thieves (or pick pockets) are everywhere. I've seen extremely suspicious activity in Portland, Los Angeles, Washington DC, Barcelona, Florence, Pisa, and Krakow. Years ago in Washington DC I had stuff stolen from me twice so I've been observant and careful ever since. Anywhere there are non-residents distracted by looking at new vistas while suffering from travel fatigue is where most thieves can be found. I've learned a lot by observation and doing research but I don't claim to be an expert. All I claim to be is someone who doesn't want to be ripped off far from home. The Basics: Any place with tourists is risky While it can be said that thieves can be anywhere, the truth is that they focus on where the tourists go. … -
Comics v2.2.0 released with Django 1.5 support
Version 2.2.0 of my comics aggregator is now released. It features a general upgrade of dependencies, including the move from Django 1.4 to Django 1.5, and a lot of updates to comic crawlers. The Django upgrade was completed months ago and it’s been running my Comics instance since, so it’s about time to get it released before Django 1.6 arrives in a month or two. Regarding the crawler updates, it’s a bit sad to see that many of the crawlers have been broken for months without me or anybody else noticing, but it’s hard to catch some content lacking in the middle of a firehose of similar content. I guess I’ll have to make it a monthly task to look through the crawler status page of my Comics instance and do patch releases with updated crawlers. Check out the project docs for more information about Comics and this release in particular. -
Factory Boy as an Alternative to Django Testing Fixtures
When testing a Django application you often need to populate the test database with some sample data. The standard Django TestCase has support for fixture loading but there are a number of problems with using fixtures: First, they must be updated each time your schema changes. Second, they force you to hard-code dates which can create test failures when your date, which was “very far in the future” when the fixture was created, has now just passed. Third, fixtures are painfully slow to load. They are discovered, deserialized and the data inserted at the start of every test method. Then at the end of the test that transaction is rolled back. Many times you didn’t even use the data in the fixture. What is the alternative to fixtures? It’s simple: your test cases should create the data they need. Let’s take a simple model: # models.py from django.db import models class Thing(models.Model): name = models.CharField(max_length=100) description = models.CharField(max_length=100) def __unicode__(self): return self.name Now we want to write some tests which need some Things in the database. # tests.py import random import string from django.test import TestCase from .models import Thing def random_string(length=10): return u''.join(random.choice(string.ascii_letters) for x in range(length)) class ThingTestCase(TestCase): … -
Factory Boy as an Alternative to Django Testing Fixtures
When testing a Django application you often need to populate the test database with some sample data. The standard Django TestCase has support for fixture loading but there are a number of problems with using fixtures: -
Django Round-Up
Click here to see this post in it's natural habitat and to watch and leave comments. For a while now we've sent out a regular newsletter called the Django Round-Up, a collection of recent links, packages, and jobs in the Django community, curated by Pete Baumgartner. It's a great resource for keeping up with the Django community and filling in the gaps of what you might have seen in your feeds or on social networks. We've decided to take the Round-Up a step further, so yesterday we published the first episode of our new Django Round-Up podcast! Hosted by Kenneth Love and Brandon Konkle, the podcast covers recent activity in the Django community with a lighthearted and conversational style. Check out the temporary site to listen or subscribe, and watch for new episodes as we will be recording them frequently. The links won't always be the same ones you see in the newsletter, so keep an eye on the site to see what links we cover in each episode even if you don't have time to listen to the show. We hope you enjoy the show, and keep an eye out for more announcements in the future! -
Django Round-Up
For a while now we've sent out a regular newsletter called the Django Round-Up, a collection of recent links, packages, and jobs in the Django community, curated by Pete Baumgartner. It's a great resource for keeping up with the Django community and filling in the gaps of what you might have seen in your feeds or on social networks. We've decided to take the Round-Up a step further, so yesterday we published the first episode of our new Django Round-Up podcast! Hosted by Kenneth Love and Brandon Konkle, the podcast covers recent activity in the Django community with a lighthearted and conversational style. Check out the temporary site to listen or subscribe, and watch for new episodes as we will be recording them frequently. The links won't always be the same ones you see in the newsletter, so keep an eye on the site to see what links we cover in each episode even if you don't have time to listen to the show. We hope you enjoy the show, and keep an eye out for more announcements in the future! -
Django Round-Up
-
The Business of Sentry
Two weeks ago I attended EuroPython. It’s one of my favorite events of the year (likely because of the amazing venue it’s been at for the last three of those). This year I gave a talk on how we operate Sentry, titled “Open Source as a Business”. It goes into details on how … -
The Business of Sentry
Two weeks ago I attended EuroPython. It's one of my favorite events of the year (likely because of the amazing venue it's been at for the last three of those). This year I gave a talk on how we operate Sentry, titled "Open Source as a Business". It goes into details on how we op... -
The Business of Sentry
Two weeks ago I attended EuroPython. It’s one of my favorite events of the year (likely because of the amazing venue it’s been at for the last three of those). This year I gave a talk on how we operate Sentry, titled “Open Source as a Business”. It goes into details on how we operate Sentry (from... -
Caktus is hiring a Design Visionary and User Experience Virtuoso with a Knack for Coding
Do your mornings usually consist of reading design blogs and drinking coffee? Are you obsessive about fonts? Are you constantly seeking out new inspiration to make your designs better? As a Front-End Developer + Designer at Caktus, you’ll be able to put your passion for design and development to work by creating beautiful designs for complex websites. You will work closely with clients to bring their visions to life and help lead the branding and design process. Our designers take ownership of the user experience and design process from the beginning and collaborate with our development team to implement the vision. You should be passionate about the open source community and the philosophy behind it. If you’re interested in becoming part of and contributing to a creative, dynamic team, here’s an idea of what you’ll do: