Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
PyCon 2015 Talks: Our Must See Picks (1/6)
Whether you couldn’t make it to PyCon this year, were busy attending one of the other amazing talks, or were simply too enthralled by the always popular “hallway track”, there are bound to be talks you missed out on. Thankfully, the PyCon staff does an amazing job not only organizing the conference for the attendees and the days of the conference, but also by producing recordings of all the talks for anyone who couldn’t attend. Even if you attended, you couldn’t have seen every talk, so these recordings are a great safety net. -
Why did Caktus Group start Astro Code School?
Our Astro Code School is now officially accepting applications to its twelve-week Python & Django Web Development class for intermediate programmers! To kick off Astro’s opening, we asked Caktus’ CTO and co-founder Colin Copeland, who recently won a 2015 Triangle Business Journal 40 Under 40 Leadership Award, and Astro’s Director Brian Russell to reflect on the development of Astro as well as the role they see the school playing in the Django community. -
Release 0.10.0
We just released LFS 0.10.0. Changes Adds Django 1.8 support 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 -
Caktus Group's Colin Copeland Recognized Among TBJ’s 40 Under 40
Caktus co-founder and Chief Technology Officer, Colin Copeland, is among an outstanding group of top business leaders to receive the Triangle Business Journal’s 2015 40 Under 40 Leadership Award. The award recognizes individuals for their remarkable contributions to their organizations and to the community. -
PyCon 2015 ReCap
The best part of PyCon? Definitely the people. This is my fifth PyCon, so I’ve had a chance to see the event evolve, especially with the fantastic leadership of Ewa Jodlowska and Diana Clarke. We were also lucky enough to work with them on the PyCon 2015 website. This year we were once again located in the Centre-Ville section of Montreal, close to lots of great restaurants and entertainment. Mark Lavin, David Ray, and Caleb Smith arrived before the official start of the conference to host a workshop on “Building SMS Applications with Django.” As avid users of RapidSMS for many of our of projects, including UNICEF’s Project Mwana and the world’s first SMS voter registration app for Libya, it was a great experience to share our knowledge. We also had a chance to work with future Django developers through the DjangoGirls Workshop this year. Karen Tracey, David Ray, and Mark Lavin served as mentors to help the mentees build their first Django app. It was wonderful to watch new programmers develop their first apps and we are looking forward to participating in similar events in the future. The conference kicked off Thursday night with a reception where we debuted … -
Now Launching: Astro Code School for Django and Python Education
Since moving to Durham in Fall 2014, we’ve been busy here at Caktus. We just finished renovating the first floor of our headquarters to bring the Triangle’s (and East Coast’s!) first Django and Python code school, Astro Code School. We’re proud to say that the school is now officially open and we’ll be celebrating with a public launch party on May 1st. -
Concurrency in Python vs GO
concurrency in Python vs GO At Pycon in Montreal few weeks ago I attended a talk that blew my mind away and got me thinking: Python concurrency from the Ground Up: LIVE! by David Beazley. The video is available on YouTube. The gist of the talk is that going from a synchronous to a concurrent program in Python requires a significant amount of leg work. The talk took a simple socket program that calculates the Fibonacci sum synchronously and tries to make it concurrent. It compares and contrasts various approachs: threads, multiple processes, and corountines. My take away was that there are a zillion ways of doing it in Python but none of them are great at taking advantage of multi cores. When I went through the process of typing the code used in his demo I decided for the fun of it to port it to Go. The first surprises for me was how similar the synchronous version is in both languages. The code and the micro benchmarks that follow should be taken with a grain of salt like always. Synchronous # synchronous.py from socket import * def fib(n): if n <= 2: return 1 else: return fib(n-1) + … -
Fast Immutable Python Deployments with Wheels
Alternate title: Pip 7 is Awesome, Here's Why A typical Python deployment looks like this: Pave the server, setting up a virtualenv and installing any pre-requisites necessary to build/install the Python requirements (compiler, development headers, etc.). To update to a new release: Update your source code Install its dependencies into the virtualenv via something like pip install -r requirements.txt This approach works, but is lacking in a few ways: Deployments are dependent on the network and availability of PyPI. "Clean" installs are prohibitively slow to do on every deploy. Because of that: You can't easily/quickly rollback to a previous release. The virtualenv will accrue cruft over time as dependencies are added/removed. Docker solves a number of these problems, but for many reasons I'm not sold on using it in production (yet). The good news is that today's release of Python's package installer, pip (version 7), will help you solve all these issues without Docker. It uses Python's wheel format to cache binary builds of the dependencies. Wheels are extremely fast, particularly for packages that require compilation (Pillow, psycopg2, lxml, etc.) "How fast?" you may ask... Well, let's look at a few examples using our fork of the Wagtail demo project … -
Release 0.9.0
We just released LFS 0.9.0. This is a bugfix release. Changes Replaced deprecated mimetype with content_type (Pigletto) Added lfs_regenerate_thumbs command (Sasha Vincic) Added links from property group property tab to properties See README.txt for more changes. 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 -
Project Repositories Have Moved to GitHub
With Google announcing last month that they are shutting down Google Code I have moved my old and unloved code repositories to GitHub. The main code base that seems to still be in use by others is the Django Full Serializer which I may split out into its own repository one day. -
Saving Data from Strava
Getting data can be easy. Effectively saving it from one source to your database can be a pain. In this video we explore a way to get data from Strava and save it to our database with as little future trouble as possible.Watch Now... -
strftime for datetime before 1900 year
Recently I’ve got an error for birthdays before 1900 year 1 ValueError: year=1890 is before 1900; the datetime strftime() methods require year >= 1900 for this code: 1 2 import datetime datetime.date(1890,7,1).strftime('%d.%m.%Y') And it’s described in the documentation The full set of format codes supported varies across platforms, because Python calls the platform C library’s strftime() function, and platform variations are common. To see the full set of format codes supported on your platform, consult the strftime(3) documentation. The exact range of years for which strftime() works also varies across platforms. Regardless of platform, years before 1900 cannot be used. One of the ways to solve this: 1 2 birthday = datetime.date(1890,7,1) '{0.day:02d}.{0.month:02d}.{0.year:4d}'.format(birthday) -
Python Praise
How I moved from PHP to Django -
DiamondHacks 2015 Recap
Image via Diamond Hacks Facebook Page This past weekend, Technical Director Mark Lavin came out to support DiamondHacks, NCSU’s first ever hackathon and conference event for women interested in computer science. Not only is NCSU Mark’s alma mater, but he’s also a strong supporter of co-organizer Girl Develop It RDU (GDI), of which Caktus is an official sponsor. -
DiamondHacks 2015 Recap
Image via Diamond Hacks Facebook Page This past weekend, Technical Director Mark Lavin came out to support DiamondHacks, NCSU’s first ever hackathon and conference event for women interested in computer science. Not only is NCSU Mark’s alma mater, but he’s also a strong supporter of co-organizer Girl Develop It RDU (GDI), of which Caktus is an official sponsor. The weekend’s events began Saturday with nervous excitement as Facebook developer Erin Summers took the stage for her keynote address. Most memorable for Mark was a moment towards the end of Summers’ talk, in which she called for collaboration between neighboring audience members. It was at this point Mark first realized he was the only male in the room—a unique experience for a male developer. “I’m sure there’s lots of women who have felt the way I did,” Mark commented. The moment not only flipped the norms of a traditionally male-dominated field, but also filled Mark with a renewed appreciation for the importance of active inclusivity in the tech industry. Aside from helping fill swag bags for the weekend’s participants and attending several of the talks, Mark gave a lightning talk, “Python and Django: Web Development Batteries Included” on Python and Django. … -
Django, pytz, NonExistentTimeError and AmbiguousTimeError
Brief: In one of the project I work on we had to convert some old naive datetime objects to timezone aware ones. Converting naive datetime to timezone aware one is usually a straightforward job. In django you even have a nice utility function for this. For example: import pytz from django.utils import timezone timezone.make_aware(datetime.datetime(2012, 3, 25, 3, 52), timezone=pytz.timezone('Europe/Stockholm')) # returns datetime.datetime(2012, 3, 25, 3, 52, tzinfo=<DstTzInfo 'Europe/Stockholm' CEST+2:00:00 DST>) Problem: You can use this for quite a long time until one day you end up with something like this: timezone.make_aware(datetime.datetime(2012, 3, 25, 2, 52), timezone=pytz.timezone('Europe/Stockholm')) # which leads to Traceback (most recent call last): File "", line 1, in File "/home/ilian/venvs/test/lib/python3.4/site-packages/django/utils/timezone.py", line 358, in make_aware return timezone.localize(value, is_dst=None) File "/home/ilian/venvs/test/lib/python3.4/site-packages/pytz/tzinfo.py", line 327, in localize raise NonExistentTimeError(dt) pytz.exceptions.NonExistentTimeError: 2012-03-25 02:52:00 Or this: timezone.make_aware(datetime.datetime(2012, 10, 28, 2, 52), timezone=pytz.timezone('Europe/Stockholm')) #throws Traceback (most recent call last): File "", line 1, in File "/home/ilian/venvs/test/lib/python3.4/site-packages/django/utils/timezone.py", line 358, in make_aware return timezone.localize(value, is_dst=None) File "/home/ilian/venvs/test/lib/python3.4/site-packages/pytz/tzinfo.py", line 349, in localize raise AmbiguousTimeError(dt) pytz.exceptions.AmbiguousTimeError: 2012-10-28 02:52:00 Explanation: The reason for the first error is that in the real world this datetime does not exists. Due to the DST change on this date the clock jumps from 01:59 … -
Django, pytz and NonExistentTimeError
Brief: In one of the project I work on we have convert some old naive datetime object to timezone aware ones. Converting naive datetime to timezone aware one is usually straightforward job. In django you even have a nice utility function for this. For example: import pytz from django.utils import timezone timezone.make_aware(datetime.datetime(2012, 3, 25, 3, 52), timezone=pytz.timezone('Europe/Stockholm')) # returns datetime.datetime(2012, 3, 25, 3, 52, tzinfo=<DstTzInfo 'Europe/Stockholm' CEST+2:00:00 DST>) Problem: You can use this for quite a long time until one day you end up with something like this: timezone.make_aware(datetime.datetime(2012, 3, 25, 2, 52), timezone=pytz.timezone('Europe/Stockholm')) # which leads to Traceback (most recent call last): File "", line 1, in File "/home/ilian/venvs/test/lib/python3.4/site-packages/django/utils/timezone.py", line 358, in make_aware return timezone.localize(value, is_dst=None) File "/home/ilian/venvs/test/lib/python3.4/site-packages/pytz/tzinfo.py", line 327, in localize raise NonExistentTimeError(dt) pytz.exceptions.NonExistentTimeError: 2012-03-25 02:52:00 Explanation: The reason for this error is that in the real world this datetime does not exists. Due to the DST change on this date the clock jumps from 01:59 directly to 03:00. Fortunately (or not) pytz is aware of the fact that this time is invalid and will throw the exception above. Why this happens? Well we couldn't be sure how exactly this one got into our legacy data but the … -
Tastypie with ForeignKey
Tastypie with ForeignKeys This is a followup post on Getting started with tastypie. We will use the same project setup as used in the last post. This post will cover: Fetch ForeignKey data in GET calls Create an object with ForeignKeys using POST calls Setup the application Let's add the capability to categorise the expenses Add a model called ExpenseCategory class ExpenseCategory(models.Model): name = models.CharField(max_length=100) description = models.TextField() Add a FK from Expense to ExpenseCategory class Expense(models.Model): description = models.CharField(max_length=100) amount = models.IntegerField() user = models.ForeignKey(User, null=True) category = models.ForeignKey(ExpenseCategory, null=True) There already exists some Expense in db without an associated category, so make ExpenseCategory as nullable. Create and apply migrations python manage.py makemigrations python manage.py migrate Let's create an expensecategory from shell and associate it with an expense of user Sheryl. u = User.objects.get(username='sheryl') ec = ExpenseCategory.objects.create(name='Misc', description='Miscellaneous expenses') e = Expense.objects.create(description='Went to Stockholm', amount='5000', user=u, category=ec) Get FK fields in response too. We want category in Expense GET endpoint too. Our first approach would be adding 'category' to ExpenseCategory.Meta.fields. Try it fields = ['description', 'amount', 'category'] Try the expense GET endpoint for Sheryl http://localhost:8000/api/expense/?username=sheryl&api_key=1a23&format=json Still don't see category in response. We need something more than this. Adding fields.ForeignKey … -
Welcome to Our New Staff Members
We’ve hit one of our greatest growth points yet in 2015, adding nine new team members since January to handle our increasing project load. There are many exciting things on the horizon for Caktus and our clients, so it’s wonderful to have a few more hands on deck. -
Welcome to Our New Staff Members
We’ve hit one of our greatest growth points yet in 2015, adding nine new team members since January to handle our increasing project load. There are many exciting things on the horizon for Caktus and our clients, so it’s wonderful to have a few more hands on deck. One of the best things about working at Caktus is the diversity of our staff’s interests and backgrounds. In order of their appearance from left to right in the photos above, here’s a quick look at our new Cakti’s roles and some fun facts: Neil Ashton Neil was also a Caktus contractor who has made the move to full-time Django developer. He is a keen student of more than programming languages; he holds two degrees in Classics and another Master’s in Linguistics. Jeff Bradberry Though Jeff has been working as a contractor at Caktus, he recently became a full-time developer. In his spare time, he likes to play around with artificial intelligence, sometimes giving his creations a dose of inexplicable, random behavior to better mimic us poor humans. Ross Pike Ross is our new Lead Designer and has earned recognition for his work from Print, How Magazine, and the AIGA. He also … -
High Performance Django Infrastructure Preview
One of the most common requests we've heard since releasing our book, High Performance Django is: "Do you have more code/configuration examples?" It's a pretty loaded question because the book covers everything from Python code to deploying and configuring servers. After some thinking on how to deliver this in a format people could easily understand, I realized the answer was already right under our noses. We've been users of Salt for configuration management for almost three years. Over the last few weeks I've been extracting our internal Salt states into a reusable and extensible system I like to call "infrastructure-in-a-box". It encompasses all the lessons we've learned over the years with our different clients and allows anyone to setup a complete Python website (load balancer, web accelerator, cache, database, task queue, etc.) in about 15 minutes. The exact same code can be used to setup a single Vagrant machine on your laptop or a ten server farm in the cloud. I whipped together a quick screencast preview of it in action (apologies for the low-quality audio): I'm really excited about being able to offer this as a companion product to our book. It's going to save people a lot of … -
RevSys Roundup - March 2015
RevSys Roundup - March 2015 -
Twitter way back machine
One of the associates at Techstars created this beautiful demo of Stream’s technology (github repo). If you ever wondered about Thomas Edison’s or Nikola Tesla’s tweets, check it out! :) Share and Enjoy: -
Getting started with Django tastypie
Django tastypie is a library to write RESTful apis in Django. Why use REST You have a database backed web application. This application tracks expenses. The application allows the capability to enter your expenses, view all your expenses, delete an expense etc. Essentially this application provides CRUD functionality. Django application has access to database credentials, but they are never seen by the users of the web application. Django application decides what to show to which user. Django application ensures that a particular user only sees the expenses entered by him and not somebody else's expenses. Now you want to provide a mobile application (Android or iOS) corresponding to this web application. Android application should allow the user to view his expenses, create an expense as well as any other CRUD functionality. But database credentials could not be put in Android code as it is not too hard to decompile an apk and get the db credentials. And we never want a user to get the db credentials else he will be in a position to see everyone's expenses and the entire database. So there has to be another way to allow mobile applications to get things from the database. This … -
Astro Code School Now Accepting Applications - Intermediate Django + Python
I’m really happy to officially announce the first Python and Django Web Engineering class at Astro Code School. I’ll outline some details here and you can also find them on our classes page.