Django community: Community blog posts RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Making Django play nicely with AngularJS
Introduction During the development of a new feature to allow users to "pin" content to read at a later date, we came up against the age-old problem in our application - how to write javascript without a whole heap of boilerplate. We've tried various approaches in the past, e.g. using Handlebars to template data received from the server, and wrapping up some repeated operations in some hand-rolled "libraries". We'd chosen not to use a javascript framework previously since jQuery is a pretty powerful tool which could be used to meet most of our needs since our application consists of many pages which require a small degree of progressive enhancement and not a full-blown client-side application. This pinning challenge was a bit different from problems we'd come across before since there would be a pins widget on almost every page in the site and any page that contained our editorial or user-contributed content would be eligible for a pinning control, so we decided that it was the right time to choose a framework, even if it were one with a fairly minimal feature-set for wrapping some low-level operations. Why AngularJS? We identified several things which cause us irritation and slow us … -
Making Django 1.5 compatible with django-bcrypt
Last night I took the opportunity to upgrade all of getsentry.com to Django 1.5. While most things were fairly trivial to sort out, we hit one less obvious (and pretty critical) bug during the migration surrounding django-bcrypt. This bug would only present itself if you’ve transitioned from … -
Making Django 1.5 compatible with django-bcrypt
Last night I took the opportunity to upgrade all of getsentry.com to Django 1.5. While most things were fairly trivial to sort out, we hit one less obvious (and pretty critical) bug during the migration surrounding django-bcrypt. This bug would only present itself if you've transitioned from old... -
Upgrades: Django Old to Django New
Upgrades: Making the Jump from Django Old to Django New Sometimes we are faced with the challenge of upgrading old Django-based projects. The task can be daunting, as a lot has happened in Django within the last few years. Since Django 1.1.1, Django has been through 15 micro ... -
Making Django 1.5 compatible with django-bcrypt
Last night I took the opportunity to upgrade all of getsentry.com to Django 1.5. While most things were fairly trivial to sort out, we hit one less obvious (and pretty critical) bug during the migration surrounding django-bcrypt. This bug would only present itself if you've transitioned from old... -
Einladung zur Django-UserGroup Hamburg am 08. Mai
Das nächste Treffen der Django-UserGroup Hamburg findet am Mittwoch, den 08.05.2013 um 19:30 statt. Dieses Mal treffen wir uns wieder in den Räumen der intosite GmbH im Poßmoorweg 1 (3.OG) in 22301 Hamburg. Die Organisation der Django-UserGroup Hamburg findet ab jetzt über Meetup statt. Um automatisch über zukünftige Treffen informiert zu werden, werdet bitte Mitglied in unserer Meetup-Gruppe: http://www.meetup.com/django-hh 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. Konkrete Vorträge ergeben sich erfahrungsgemäß vor Ort. Eingeladen ist wie immer jeder der Interesse hat sich mit anderen Djangonauten auszutauschen. Eine Anmeldung ist nicht erforderlich, hilft aber bei der Planung. Weitere Informationen über die UserGroup gibt auf unserer Webseite www.dughh.de. -
New Committers for Tastypie & Haystack
New Committers for Tastypie & Haystack -
Tools we used to write Two Scoops of Django
Because of the ubiquitousness of reStructuredText in the lives of Python developers and the advocacy of it, it's not uncommon for people to assume we used it to write our book. However, that's not really the case. The short Answer is we used: reStructuredText (RST) Google Documents Apple Pages LaTeX The long answer is the rest of this posting. Since writing the book was broken up into three major stages 'alpha', 'beta', and 'final', so have I broken up blog article. Alpha Days Some of the original alpha material was written in rough draft form as RST since it was what we were used to using. Unfortunately, the PDF generation wasn't to our liking, so we immediately began looking at other options. Since she enjoyed using it at MIT and because it gave us greater individual control, Audrey wanted to switch to LaTeX. I was worried about the challenges of learning LaTeX, so we compromised and moved to Google Documents. For the most part, Google Documents was great in the early stages. The real-time collaborative nature was handy, but the gem was the comment system. It gave us the ability to have line-by-line written dialogues with our technical reviewers. However, … -
Tools we used to write Two Scoops of Django
Because of the ubiquitousness of reStructuredText in the lives of Python developers and the advocacy of it, it's not uncommon for people to assume we used it to write our book. However, that's not really the case. The short answer is we used: reStructuredText (RST) Google Documents Apple Pages LaTeX The long answer is the rest of this posting. Since writing the book was broken up into three major stages 'alpha', 'beta', and 'final', so have I broken up blog article. Alpha Days Some of the original alpha material was written in rough draft form as RST since it was what we were used to using. Unfortunately, the PDF generation wasn't to our liking, so we immediately began looking at other options. Since she enjoyed using it at MIT and because it gave us greater individual control, Audrey wanted to switch to LaTeX. I was worried about the challenges of learning LaTeX, so we compromised and moved to Google Documents. For the most part, Google Documents was great in the early stages. The real-time collaborative nature was handy, but the gem was the comment system. It gave us the ability to have line-by-line written dialogues with our technical reviewers. However, … -
Box Office Champs Launches
A fantasy movie game built using Django. This is a very easy game where you pick the 15 movies you think will be the highest grossing movies of the season. You can create a group and compete with your friends. You should give the site a try today. Iron Man 3 opens tomorrow and you definitely want to have that movie on your roster. Unlike fantasy sports, you can play this game 4 times a year. The summer season starts tomorrow. Kudos to Rudy Menendez who did principal development and game design and Noah Wenz for design and HTML. The site was with spare time over the last few months. Put together, development time was about 2-3 weeks. If you need a fantasy site done, contact Ed or Rudy Menendez and we can help you out. -
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 …