Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
PiCloud: near-free Heroku background worker for Django in 3 steps
Do you know PiCloud offers free 20 hours/mo of background processing of jobs, billed for msec of CPU running? Combo this with Heroku PaaS hosting solution allowed us at KomboBreaker to deploy background-heavy products for little money (and no worker dyno). Although using PiCloud with Heroku and Django is not “that trivial”. Follow this 3 steps and offload you Heroku jobs to PiCloud for your start-up: 1) Add ‘cloud' to your ‘requirements.txt’ file Adding a line with the text ‘cloud' it to the bottom of your requirements.txt file … Continue reading → -
A quick review of Django 1.5 Application Development Starter ebook
Django 1.5 Application Development Starter is an ebook published by Packt Publishing and sold for less than 7 EUR at the time of writing this review. Few weeks ago the publisher contacted me if I could review their new Django ebook. It took me some time but I managed to go through it and get the big picture of this book. The "Django 1.5 Application Development Starter" consist of 63 pages describing Django 1.5 (based on RC 1 and Python 2) framework - how to get started by developing a typical application using models, forms, templates or admin panel and other framework features. The ebook is divided into few big chapters. At start we get to know Django - what it is and why it's s cool. Next the installation process, third project creation quickstart. After that we get a bigger chapter describing framework components - settings, models, url patterns, templates, forms and admin panel. It's not a technical description. All is don on an example application (questions and answers) that is being developed page by page using mentioned framework components. By the end we get some information about deployment - basic server configuration including Nginx. The book ends with … -
Django Facebook hotfix, update to 5.0.13
Last night Facebook changed the format they use for codes. (codes are an intermediate step in the process of requesting access tokens.) This change broke the caching for the convert code step for Django Facebook, breaking login, connect and registration functionality. Fortunately this was quickly reported by developers in a country where there was no Queensday yesterday. I encourage everybody to update to 5.0.13 to make sure your Facebook integration keeps on working. Share and Enjoy: -
AngularJS to PyGame: Caktus’ 2nd ShipIt Day
We had our 2nd ShipIt Day at Caktus last week. ShipIt (coined by Atlassian), in case you don’t know, is an exercise that allows your team to work on alternative projects in a 24-hour hackathon. We brainstorm ideas related to Caktus, break into small groups and try to build a project by the end of the day on Friday. It’s a lot of fun and provides an opportunity to work on internal tools, try something new and collaborate together. We had a lot of great projects this time around. From diving into AngularJS to building a PyGame for learning how to program. I’ve written up a short summary here to show everyone what we worked on. You can view a whole Flickr gallery of our ShipIt day here. Learn a New Framework We build most projects in Django at Caktus, but it’s fun to learn about alternatives. Dan, Karen and Mark teamed up to explore alternative languages and frameworks. The idea was to build a HTTP service in the framework of your choice that would return whether or not a word was spelled correctly. A simple Python-based test suite was used to test spell checking a few words. In the end, 5 languages/frameworks were tested: Lua, … -
Common testing scenarios for Django app.
People are often confused regarding what tests to write. Let's look into some scenarios for which tests can be written. Setting up the project We start a Django project inside a virtual environment. In this post we would be using django 1.4. (dj)~/play/dj$ django-admin.py startproject testcases Let's start an app named blog. (dj)~/play/dj/testcases$ python manage.py startapp blog We will have the following model in blog/models.py: class BlogEntry(models.Model): title = models.CharField(max_length=100) text = models.TextField() is_published = models.BooleanField(default=True) user = models.ForeignKey(User) We will do test driven development which requires: Thinking about our assumption. Writing the test to satisfy that assumption. Run the test and it will fail since we won't have view written till this point. Adding the view. Run the test and fixing the view or anything else till our test passes. If I could not explain the project structure properly, you can find the complete project here. First test We want a page which shows all blog entries at url /blog/entries/. We need following line in urls i.e testcases/urls.py url(r'^blog/', include('blog.urls')), blog/urls.py url(r'^entries/$', 'blog.views.entries', name='entries'), Let's add a test which satisfies our assumption. Every app we create gets a tests.py where we can put our tests. You can remove the … -
Python Interview Question and Answers
For the last few weeks I have been interviewing several people for Python/Django developers so I thought that it might be helpful to show the questions I am asking together with the answers. The reason is … OK, let me tell you a story first. I remember when one of my university professors introduced to us his professor – the one who thought him. It was a really short visit but I still remember one if the things he said. “Ignorance is not bad, the bad thing is when you do no want to learn.” So back to the reason – if you have at least taken care to prepare for the interview, look for a standard questions and their answers and learn them this is a good start. Answering these question may not get you the job you are applying for but learning them will give you some valuable knowledge about Python. This post will include the questions that are Python specific and I’ll post the Django question separately. How are arguments passed – by reference of by value? The short answer is by value. The longer one starts with the fact that this terminology is probably not the … -
Structuring flask apps, a how-to for those coming from Django
The other day a friend of mine was trying out flask-peewee and he had some questions about the best way to structure his app to avoid triggering circular imports. For someone new to flask, this can be a bit of a puzzler, especially if you're coming from django which automatically imports your modules. In this post I'll walk through how I like to structure my flask apps to avoid circular imports. In my examples I'll be showing how to use "flask-peewee", but the same technique should be applicable for other flask plugins. I'll walk through the modules I commonly use in my apps, then show how to tie them all together and provide a single entrypoint into your app. Project layout I use a structure that may look familiar to users of the django framework: admin.py - Where you register models with the site admin interface api.py - Where you register models to be exposed via a REST-ful API app.py - Your "Flask" application, configuration, and database. auth.py - The authentication system used to protect access to the admin. main.py - this is the secret sauce models.py - Database models for use with your ORM, business logic, etc. views.py - … -
Structuring flask apps, a how-to for those coming from Django
The other day a friend of mine was trying out flask-peewee and he had some questions about the best way to structure his app to avoid triggering circular imports. For someone new to flask, this can be a bit of a puzzler, especially if you're coming from django which automatically imports your modules. In this post I'll walk through how I like to structure my flask apps to avoid circular imports. In my examples I'll be showing how to use "flask-peewee", but the same technique should be applicable for other flask plugins. I'll walk through the modules I commonly use in my apps, then show how to tie them all together and provide a single entrypoint into your app. Project layout I use a structure that may look familiar to users of the django framework: admin.py - Where you register models with the site admin interface api.py - Where you register models to be exposed via a REST-ful API app.py - Your "Flask" application, configuration, and database. auth.py - The authentication system used to protect access to the admin. main.py - this is the secret sauce models.py - Database models for use with your ORM, business logic, etc. views.py - … -
Structuring flask apps, a how-to for those coming from Django
The other day a friend of mine was trying out flask-peewee and he had some questions about the best way to structure his app to avoid triggering circular imports. For someone new to flask, this can be a bit of a puzzler, especially if you're coming from django which automatically imports your modules. In this post I'll walk through how I like to structure my flask apps to avoid circular imports. In my examples I'll be showing how to use "flask-peewee", but the same technique should be applicable for other flask plugins. I'll walk through the modules I commonly use in my apps, then show how to tie them all together and provide a single entrypoint into your app. Project layout I use a structure that may look familiar to users of the django framework: admin.py - Where you register models with the site admin interface api.py - Where you register models to be exposed via a REST-ful API app.py - Your "Flask" application, configuration, and database. auth.py - The authentication system used to protect access to the admin. main.py - this is the secret sauce models.py - Database models for use with your ORM, business logic, etc. views.py - … -
Structuring flask apps, a how-to for those coming from Django
The other day a friend of mine was trying out flask-peewee and he had some questions about the best way to structure his app to avoid triggering circular imports. For someone new to flask, this can be a bit of a puzzler, especially if you're coming from django which automatically imports your modules. In this post I'll walk through how I like to structure my flask apps to avoid circular imports. In my examples I'll be showing how to use "flask-peewee", but the same technique should be applicable for other flask plugins. I'll walk through the modules I commonly use in my apps, then show how to tie them all together and provide a single entrypoint into your app. Project layout I use a structure that may look familiar to users of the django framework: admin.py - Where you register models with the site admin interface api.py - Where you register models to be exposed via a REST-ful API app.py - Your "Flask" application, configuration, and database. auth.py - The authentication system used to protect access to the admin. main.py - this is the secret sauce models.py - Database models for use with your ORM, business logic, etc. views.py - … -
Structuring flask apps, a how-to for those coming from Django
The other day a friend of mine was trying out flask-peewee and he had some questions about the best way to structure his app to avoid triggering circular imports. For someone new to flask, this can be a bit of a puzzler, especially if you're coming from django which automatically imports your modules. In this post I'll walk through how I like to structure my flask apps to avoid circular imports. In my examples I'll be showing how to use "flask-peewee", but the same technique should be applicable for other flask plugins. I'll walk through the modules I commonly use in my apps, then show how to tie them all together and provide a single entrypoint into your app. Project layout I use a structure that may look familiar to users of the django framework: admin.py - Where you register models with the site admin interface api.py - Where you register models to be exposed via a REST-ful API app.py - Your "Flask" application, configuration, and database. auth.py - The authentication system used to protect access to the admin. main.py - this is the secret sauce models.py - Database models for use with your ORM, business logic, etc. views.py - … -
Recent Revsys Updates
Recent Revsys Updates -
Raspberry pi
Abans de festes en Xisco (a.k.a Zigazaga) em va dur la Raspberry, la idea era provar-la per mirar de substituir els ordenadors Pentium IV dels nins, però sobretot veure de primera mà aquest petit dispositiu del qual se n'estava parlant tant a la xarxa. Tanmateix el cost d'un dispositiu així si fa no fa és el d'un sopar sense postres, així que l'experiment si sortia malament tampoc no era excessivament complicat. Xisco va dur la Rasberry i una capseta, tot queda molt compacte, la veritat. Una visita al magatzem xinès del costat de l'oficina va proporcionar el cable per connectar el monitor i vaig reciclar una tarja SD de 32 Gb que tenia sense utilitzar i que ara torna a ser al caixò dels cables. La instal·lació va ser cosa de baixar-se la Rasbian, crear el disc d'instal·lació i seguir les instruccions, en poc menys d'una hora el sistema complet i funcionant, amb l'entorn gràfic i tot. Es pot fer feina, però va molt justet de velocitat. Els nins estan acostumats a jugar online, a l'OpenOffice i ja vaig veure que no aniria gairebé la cosa. Tot i això per fer feina ofimàtica i programar va prou bé. Així que … -
Managing Django Translations with Transifex
We manage a number of open source Django apps here at Caktus. While many of us here are proficient in a number of programming languages, the same can’t be said for our ability to read or write in languages other than English. The Django community is global and we want our apps to support other languages. For that we’ve turned to Transifex which it the same tool Django itself uses for translations. If you aren’t familiar with Transifex, it’s an open-source localization platform. There are paid plans for private projects, but you can have a free plan if you are managing translations for an open source project. You can import your translation files, add new languages and review translation progress all with managed teams of translators. You can also make use of machine translation services such as Google Translate or Microsoft Translator. Setting up a project is simple. Once you have an account, you choose to add a new project from the dashboard. You need to pick a name which you can simply match to your project name if it is available. You also need to pick a source language, for us that would be English, and a license. We … -
Filepicker.io and South
I've heard good things about filepicker.io, which is a service that makes file uploading a much better experience. Unfortunately, the Django package for filepicker.io doesn't work with South. When I try to create a migration using the filepicker.io field using code like the following... # products/models.py from django.db import models from django_filepicker.models import FPFileField class Product(models.Model): title = models.CharField(max_length=255) file = FPFileField(upload_to='uploads') ...when I try to run the command: (tsd)$ python manage.py schemamigration products --initial It results in this unpleasant looking response: (tsd)$ python manage.py schemamigration products --initial Creating migrations directory at '/Users/danielgreenfeld/code/tsp/tsp/products/migrations'... Creating __init__.py in '/Users/danielgreenfeld/code/tsp/tsp/products/migrations'... ! Cannot freeze field 'products.product.fpfile' ! (this field has class django_filepicker.models.FPFileField) ! Cannot freeze field 'products.release.fpfile' ! (this field has class django_filepicker.models.FPFileField) ! South cannot introspect some fields; this is probably because they are custom ! fields. If they worked in 0.6 or below, this is because we have removed the ! models parser (it often broke things). ! To fix this, read http://south.aeracode.org/wiki/MyFieldsDontWork The last line in the error report is important. I'll repeat it to illustrate it more clearly: ! To fix this, read http://south.aeracode.org/wiki/MyFieldsDontWork Experience working on other projects has taught me I can simply add two lines of code … -
Filepicker.io and South
I've heard good things about filepicker.io, which is a service that makes file uploading a much better experience. Unfortunately, the Django package for filepicker.io doesn't work with South. When I try to create a migration using the filepicker.io field using code like the following... # products/models.py from django.db import models from django_filepicker.models import FPFileField class Product(models.Model): title = models.CharField(max_length=255) file = FPFileField(upload_to='uploads') ...when I try to run the command: (tsd)$ python manage.py schemamigration products --initial It results in this unpleasant looking response: (tsd)$ python manage.py schemamigration products --initial Creating migrations directory at '/Users/danielgreenfeld/code/tsp/tsp/products/migrations'... Creating __init__.py in '/Users/danielgreenfeld/code/tsp/tsp/products/migrations'... ! Cannot freeze field 'products.product.fpfile' ! (this field has class django_filepicker.models.FPFileField) ! Cannot freeze field 'products.release.fpfile' ! (this field has class django_filepicker.models.FPFileField) ! South cannot introspect some fields; this is probably because they are custom ! fields. If they worked in 0.6 or below, this is because we have removed the ! models parser (it often broke things). ! To fix this, read http://south.aeracode.org/wiki/MyFieldsDontWork The last line in the error report is important. I'll repeat it to illustrate it more clearly: ! To fix this, read http://south.aeracode.org/wiki/MyFieldsDontWork Experience working on other projects has taught me I can simply add two lines of code … -
PUN: Python Usergroup Nederland: what is it?
Summary: 6-8 free meetings per year with a couple of talks and some drinks afterwards. Find new meetings on the Dutch Django association meetup page. The Python Usergroup Netherlands (PUN) is "that which I make summaries of :-)". So I sometimes get the question "what is it?" in my inbox. I got one such question yesterday, so I'll blog my answer :-) The evenings Mostly, the PUN means a meeting every couple of months. The format is two 30-minute talks and 6 5-minute "lightning talks". In the lightning talks everybody can introduce a project (s)he worked on lately, for instance. The bigger 30-minute talks can be anything from "this is how we use python at company XYZ", "3D prototyping with Python", "Plone's new layout engine", etc. The talks are normally in English as not everyone understands Dutch. If we suspect there are only native Dutch speakers around someone might ask whether everyone understands Dutch, in that case we just speak Dutch, naturally :-) Some separate notes: The evenings are free. You don't need to be a member and you don't need to register. Registering (=clicking "I'll be there" on meetup.com) is appreciated, though, as it gives the organizer an idea … -
Off to Europe!
I feel like I'm dreaming, but we're on our way to Europe! A few weeks Audrey and I decided to move. While looking at possible rentals or even mortgages, we were idly (dreaming really... still paying off debts incurred from last year) looking at how much a room/apartment would cost to rent in Europe. To our surprise, we found a lot of good options that cost less then it would to pay monthly rent/mortgage in Los Angeles. o_O Then, we discovered an amazing travel deal. It combined a very cheap red-eye flight from Los Angeles to Fort Lauderdale, and a slow trans-atlantic ship from Port Miami to Barcelona, about as much as a cheap hotel but with free food! If we avoid alcohol and any extra fees, it's actually extremely inexpensive. Being mostly disconnected from the internet would mean we could really focus on a couple of critical projects. If only we had a business justification for going to Europe... It just so happens that we have business in Europe. Our plan is to spend a few months in Europe before returning back to the USA. We'll work hard on the ship, work hard when we arrive, and just get … -
Off to Europe!
I feel like I'm dreaming, but we're on our way to Europe! A few weeks Audrey and I decided to move. While looking at possible rentals or even mortgages, we were idly (dreaming really... still paying off debts incurred from last year) looking at how much a room/apartment would cost to rent in Europe. To our surprise, we found a lot of good options that cost less then it would to pay monthly rent/mortgage in Los Angeles. o_O Then, we discovered an amazing travel deal. It combined a very cheap red-eye flight from Los Angeles to Fort Lauderdale, and a slow trans-atlantic ship from Port Miami to Barcelona, about as much as a cheap hotel but with free food! If we avoid alcohol and any extra fees, it's actually extremely inexpensive. Being mostly disconnected from the internet would mean we could really focus on a couple of critical projects. If only we had a business justification for going to Europe... It just so happens that we have business in Europe. Our plan is to spend a few months in Europe before returning back to the USA. We'll work hard on the ship, work hard when we arrive, and just get … -
Summary of the Dutch Python meeting in Delft
We had a Python meeting tonight (18 april 2013) in Delft at the fox IT offices. I especially liked the open source marketing talk, telling us how to properly tell others about our great projects. (Note: my brother Maurits also made a summary) Github test commit info - Reinout van Rees I gave a quick lighting talk about my githubinfo script that gives you reports on the amount of tests in the last week per project and per developer. Handy for raising awareness for testing amongst your colleages if you mail around the results once a week! The source code is at https://github.com/nens/githubinfo . I already blogged about it, so you can read more there. Devops at fox IT - Ronald Evers Ronald works on detact, a fraud detection for online banking, trying to detect fraud in http traffic for online banking. They sell it to banks. The low-level stuff is in c++, the rest in Python. How do they make it? They use git, so they can use Gerrit, a code review tool. Every commit gets pushed first into a special gerrit branch on github and ends up in the gerrit tool. Every commit needs two upvotes before it … -
Caktus sponsoring and speaking on mobile health at SwitchPoint 2013
SwitchPoint is a one-of-a-kind conference and a unique opportunity to learn, share ideas, and hear about global and mobile health efforts around the world. We had a great time at SwitchPoint last year. I’m excited to announce that Caktus, for the second year in a row, is sponsoring SwitchPoint 2013. At Caktus, we enjoy working on projects that have a positive social impact and have had the opportunity to implement mobile health projects around the world, including in Nigeria, Rwanda, Zambia and Malawi. Caktus currently leads the development of RapidSMS, a free and open-source framework (built in Django) for dynamic data collection, logistics coordination and communication through text messaging (SMS). RapidSMS is used widely across Africa and other parts of the world to improve patient outcomes and save lives in urban and rural areas. Over the past 11 months, Caktus has organized efforts around improving the RapidSMS core codebase, including infrastructure enhancements and coordinating community involvement and participation. Additionally, Caktus is collaborating on UNICEF’s 1000 Days Product, which tracks the first 1000 days between a woman’s pregnancy and her child’s second birthday. 1000 days not only tracks nutrition, which is very important during early child development, but also includes mobile … -
Scheduling Periodic Tasks with Celery 2.3.3 and Django 1.4
There are going to be times in the life of your application when you'll need to perform tasks - making requests to APIs, sending emails, or storing large amounts of data, for example. To do that, you'll most likely want to implement some sort of job queue - that is, a system that lines these tasks up and executes them. Celery is a task queue commonly used with Django - it's open source, easy to integrate with many other languages and frameworks, and it can execute tasks either asynchronously (in the background) or synchronously (wait until ready). This article is going to talk about a very basic Celery implementation for Django - you'll need to have Django installed already, and we'll discuss installing and configuring celery, django-celery (Celery integration for Django), and RabbitMQ (the recommended message broker for celery). If you're using an older version of Celery, it may be a little challenging finding the right docs - for 2.3.3, start with this link: http://docs.celeryproject.org/en/v2.3.3/ And you may want to bookmark this for future reference - the Celery account on GitHub contains repositories for the official celeryproject, as well as django-celery and kombu. https://github.com/celery Installing and configuring Before you get … -
Two Scoops of Django is in print!
Since I was a child I wanted to be a published author. I've dreamt of people reading my book. While one could say that dream was fulfilled when we launched the e-book version in January, it's not the same as seeing the printed copy. Today I got to see my dream come true, a printed book is out there with my name on it. Also, I have a confession to make. When it comes to technical books, I really prefer the print version. For me, nothing beats being able to flip through pages of a hardcopy next to a keyboard, or simply reading while I'm on a bus, train, or plane. So this adds to my excitement when I get to say that the book that Audrey Roy and I wrote together is in print. Note: As of April 17th it's only available in the US. However, it's in the queue for being available for Amazon Europe. Enough people are asking that we are also looking into getting it bulk shipped to Django Circus. While it's been an amazing journey, it's also been a long hard road. Starting with a late night dinner with Randall Degges, his wife Samantha, and … -
Two Scoops of Django is in print!
Since I was a child I wanted to be a published author. I've dreamt of people reading my book. While one could say that dream was fulfilled when we launched the e-book version in January, it's not the same as seeing the printed copy. Today I got to see my dream come true, a printed book is out there with my name on it. Also, I have a confession to make. When it comes to technical books, I really prefer the print version. For me, nothing beats being able to flip through pages of a hardcopy next to a keyboard, or simply reading while I'm on a bus, train, or plane. So this adds to my excitement when I get to say that the book that Audrey Roy and I wrote together is in print. Note: As of April 17th it's only available in the US. However, it's in the queue for being available for Amazon Europe. Enough people are asking that we are also looking into getting it bulk shipped to Django Circus. While it's been an amazing journey, it's also been a long hard road. Starting with a late night dinner with Randall Degges, his wife Samantha, and … -
Logging time, part 1: github for timelogging
I've got to keep track of what I work on. The company I work for (Nelen & Schuurmans) is pretty much focused on projects, so that's what you should book your hours on. This is both for billing to clients and for internal bookkeeping: projects should be profitable, ideally, so we need to keep track of it. Now... how to do this? I fill in my hours two or three times during the month. And my memory isn't that good that I remember everything. So I look in my agenda for free days, meetings, that sort of stuff. But the majority of my work isn't in my agenda, it is in code. And the code... is in github, mostly. So what I do when filling in my hours is looking at the github timeline. See https://github.com/reinout, at the bottom is my contribution activity. That tells me enough on what I did in the last week. A different view is gitspective, see for instance my timeline. It gives you a different timeline, better for filling in your hours than github's. Apart from one detail: it misses the private repositories you worked on. And our Django sites are all private because of …