Django community: Community blog posts RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Good reasons to use django-dbtemplates
I'm loving the humble django-dbtemplate app at the moment. I wanted to share my experience here, perhaps it's something to consider for your next project. Project brief I recently deployed a nice simple django based web application to streamline an otherwise labor intensive business process. The application managed requests through a business workflow by generating emails to different people asking them to complete tasks online. Nothing particularly special but Django did the job perfectly. During the project the client required various template changes. Mainly small email and webpage tweaks really but important none the less. Managing template changes during the campaign For the first time I included django-dbtemplate in my project. Initially I didn't really have a strong reason for including it but I did anyway - it proved to be a great decision. With dbtemplates I was able to update templates on the live system via the admin interface. Just type in the name of the template to load it into the database and then make your changes. Without dbtemplates I would have had to make these changes another, either: Commiting template changes into the code base - that would have involved a full patch release including committing … -
Django: Executing manage.py from Anywhere
One nice convenience would be to have a way to call manage.py from anywhere within a virtual environment. For example, if I want to execute 'manage.py shell', it would be nice to be able to execute that from anywhere rather than having to change directory to where manage.py lives.We can already run management commands from anywhere using django-admin by utilizing the --settings flag, but doing this requires a lot of typing. And wrapping the django-admin in a shell script seems inelegant somehow.Instead, I wrote a small python script based off of manage.py. This can be placed in the ./bin directory in the virtualenv. The DjangoManageSettings object is meant to be customized on a per project basis, and I intend to make it so it can be passed in from a file configuration somewhere.Anyway, thought I would share. I'm curious to see other approaches to this.# ---------- ${VIRTUAL_ENV}/bin/django_manage.py -------------------------#!/usr/bin/env pythonimport os, sysfrom django.core.management import execute_managerclass DjangoManageSettings(object): def __init__(self): self.VENV_ROOT = os.getenv("VIRTUAL_ENV") # The name of the module that settings.py resides in self.PROJECT_NAME="myproject" # The path to the directory where the Django project lives. # I made it relative to the virtualenv root. self.PROJECT_PARENT_PATH = os.path.join(self.VENV_ROOT, "app") # The name of the django settings model in the … -
Django Hosting Roundup: (Ep.io vs Gondor.io vs DotCloud vs AppHosted vs DjangoZoom) Who wins?
For the past 6 weeks I have been trying out all of the new django/python hosting services that are currently available today, and I have been writing about my experiences along the way. It only makes sense to conclude this series of articles with one last article comparing all of the services against each other. It is important to note that many of these services are still in development and aren't even available to the general public, so I'll try to keep this article up to date as these services change over time. With that said, don't take my word for it, go out and try all of these services on your own and find out which one you like the best, you won't be disappointed. Quick Recap ep.io Pretty solid offering, with a nice set of features and a decent price. Good set of documentation. gondor.io Their website has a nice list of features that they expect to have once they officially launch, but most of those features aren't available yet. The documentation is a little light, but the service has a lot of potential. dotcloud.com They have a ton of money ($10M), and with it, a ton of … -
Getting Started with AJAX in Django: a Simple jQuery Approach
AJAX in Django using jQuery I recently created a side project to explore a few tech areas I wanted to learn more thoroughly. One of those areas was how to implement AJAX in Django using jQuery. In a nutshell, the site, TruthTruthLie.me (update 3/5/2013: the site is temporarily offline as switch my Facebook Connect implementation from django-socialregistration to django-social-auth) presents three facts about you and challenges your friends to click on the one that is a lie. When your friend clicks on a fact, I send the clicked fact_id via AJAX to a url. A Django url pattern routes the click to a view where I check what “type” the fact is, return the result via JSON to the client and update the page dynamically without a page refresh. Below are the stripped down page, url pattern and view that I use to get this done. You can also check out my simple but working AJAX in Django using jQuery demo page. ajax_in_django.html: <html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"> </script> <script type="text/javascript"> $(document).ready(function() { $('.fact').bind('click', function () { $.get("/test/"+this.id+"/", function(data) { if (data.fact_type=="T") { guess_result="This fact is true! " + data.fact_note; } else { guess_result="This fact is false! " + data.fact_note; … -
Monday lightning talks (djangocon.eu)
Time for some quick typing! The 5-minutes-a-piece lightning talks! Introducing django REST framework - Tom Christie See http://django-rest-framework.org/ . The first version was released in February. Django rest framework uses django 1.3's class based views. Very cool is that it creates web browsable APIs. We're all building cool REST services, but you can't browse them on the internet to discover about them. An API should be self-describing. But an API explorer is not the answer: it is an unnecessary indirection. It is not just about making everything shiny. If we design our API to be browsable they will be better designed and faster to work with. They're also more transparent, open and self explanatory. Making it open in this way helps you in designing it. Revised form rendering - Gregor Muellegger Revised form rendering is a GSOC project. The current rendering just plain sucks. It is not possible to change a widget on the fly. You can't change the order of the form fields without editing the python file. Etc. So: template based form rendering! There'll be a new form template tag with a couple of options to modify the form before rendering. {% formlayout "ul" %}{% form myform %} … -
Django, compass and the less framework - Idan Gazit (djangocon.eu) — Reinout van Rees' website
So if you’ve got problems on the desktop and other bigger devices, too, why do we have that mobile/the_rest split anyway? Why not just accept the continuous spectrum regarding screen sizes? -
3 CMSs in 45 minutes (djangocon.eu) — Reinout van Rees' website
-
Django and pypy - Alex Gaynor (djangocon.eu) — Reinout van Rees' website
How to use pypy? Well, just use it. manage.py runserver will work. For server side work, take any of the pure python wsgi servers. So not mod_wsgi as it is a big C extension, but use gunicorn for instance. -
How I learned to stop worrying and love python packaging - Jannis Leidel (djangocon.eu) — Reinout van Rees' website
Regular python packaging (in our case in combination with buildout) is something we use a lot. So a talk on this at the djangocon.eu is something I look upon with a favourable eye. (I’ll even take the opportunity to point you at my software releases series.) -
Large django sites at mozilla - Andy McKay (djangocon.eu) — Reinout van Rees' website
-
From static to realtime - Eric Florenzano (djangocon.eu)
Note: Eric is one of the founders of convore (see the djangocon eu 2011 group on convore). His talk is on converting a django site to the realtime age: does the django heart stay in place or is it replaced with something "more current" like node.js? In the end, he told his story as a fairy tale. Entertaining and slick. Good job! At a certain time he thought about writing a shiny new social photo website. All the cool sites were about social photo stuff. So he build one. And it became popular! And slow. So caching to the rescue. It helped. For a while. It became even more popular. Social photos mean frantic reloading of webpages. So it became slow again. Full-page reloads. Even expiry headers didn't help. Good artist copy, great artists steal. So he stole some ideas from twitter. Just a quick json endpoint that listed the most recent photos. And a bit of javascript that reloads that small bit of content every five seconds. If something has changed, a button would pop up so the user could reload. The users loved it. But every user that visited any page on the site would keep hitting that … -
Opening - Remco Wendt (djangocon.eu)
Opening of the third European Djangocon! Remco tells us to behave as there's a java island (java-eiland in Dutch, see photo below) 200m from the conference location. So if you write non-clean code during the sprints you'll be banished to this prison island :-) Nice to see our (Nelen & Schuurmans) company name right there on the left hand side on one of the big sponsor banners, btw! The question everyone is about to ask: yes, the wifi is holding up nicely :-) Warning: the public transport in Amsterdam is on strike on tuesday. Good thing that the city of Amsterdam sponsors us with free bikes for the duration of the conference. On wednesday there are bitbucket-sponsored drinks. Also several other people have been invited from tech companies in Amsterdam and from ruby/js/etc. On hashtags: on twitter, look at #djangocon. -
DjangoCon Europe 2011 live stream
LiveStream via Ustream Starting monday at 09:30 CET, DjangoCon Europe 2011 will be broadcasting live all presentations. You can tune in via Ustream using the DjangoCon Europe 2011 channel -
Preparing for djangocon (djangocon.eu)
It is sunday evening and tomorrow morning I'm going to Amsterdam for the djangocon.eu conference. I'm staying at home at night as it is close by enough. It'll mean less night rest than I'm normally getting at a conference, as I'll have to subtract a one one-way hour commute (two hours total) from every conference day's night rest. A big part of a preparation for me means preparing my talk summaries. Last year I wrote a metric buttload of summaries and this year I'm going to do the same. This does mean looking up all the talks beforehand and preparing a text file on each and every one of them. With a link to the project readily pasted in and a proper reference to the author. And an photo pasted in. I want, somehow, to have a photo for every entry. Normally I take photos in the conference town and at the conference, but I don't stay in Amsterdam itself, so I won't have much chance at making photos. Only of the station and so. So what about model train photographs? Not a bad idea at all :-) I've got a lot of photos of excellently modelled railways. Not the … -
Add your questions for the panels
Add your questions for the panels We have set up Google moderators for the scalability panel and core developers panel where you can add your own questions and vote on the questions that have already been added. -
DjangoZoom.com Review
This is part five in my series on django hosting services. Previously, I looked at ep.io, apphosted.com, gondor.io, dotcloud.com and now I'm looking at DjangoZoom.com. DjangoZoom.com is the brain child of Nate Aune and Shimon Rura and is based in Boston, Massachusetts. It was founded in 2010 at StartupWeekend Boston and was a finalist in the MassChallenge. Their office is in the Dogpatch Labs space for startups in Cambridge, Massachusetts. They are currently still in a closed beta, but they were nice enough to send me an invite to check it out. Normally when I check out a service for the first time, I look over the documentation to see what it can do, and what it can't do, and what I need to do in order to get my app up and running. DjangoZoom has a nice collection of documents that help guide you through the process of getting your application up and running on their platform. You need to be logged in, in order to read the documents, so I won't be able to link to any documents here, but if you are lucky enough to get an invite to DjangoZoom, I would check out the documents first, … -
Django-urlcrypt, après les contes c’est l’url de la crypte.
Voila, comme dit dans le billet précédent, je vais donc faire deux billets de django app de mai, ça m’apprendra à être en retard. Donc la deuxième django app du mois sera django-urlcrypt. Une petite précision avant d’aller plus loin, c’est une des toutes premières fois où je vais parler d’une app sans avoir fait plus que la tester sur un projet de test, sans avoir d’idée précise de où ni comment je vais l’utiliser ‘en vrai’. 1- Où on le trouve, comment on l’installe, tout ça quoi (et la doc) ? Alors on le trouve soit sur sa page pypi soit sur sa page github. Pour l’installation là encore, les trois moyens habituels : par easy_install pip un petit git clone des familles La doc, là c’est comme l’app précédente, elle est limitée au contenu de la page de pypi ou au fichier Readme.rst. Bon alors c’est vrai que la doc est suffisante pour comprendre comment l’app marche, mais sur une app qui est aussi ‘sensible’, une bonne lecture du code ne fait pas de mal (c’est d’ailleurs ce que j’ai fait quand j’ai commencé à faire joujou avec). 2- Mais au fait, à quoi ça sert ? En … -
Django-countries ,l’app garantie sans cowboy ni rodéo. djangoApp de mai 1 sur 2
Il va falloir que je me surveille .. parce qu’encore une fois je publie ma django app du mois un peu en retard. Pas grand chose, juste 4 jours.. Mais ça commence comme ça et après on finit par ne plus tenir de rythme du tout. Du coup, pour marquer, le coup, je publierais deux django app du mois de mai, même si je les publie en juin. Et pour commencer, django-countries. C’est d’ailleurs assez rigolo parce que je parlais il y a peu de moyen de gérer les pays, avec une liste de choix existantes, etc.. et op, je tombe sur django-countries. 1- Où on le trouve, comment on l’installe, tout ça quoi (et la doc) ? Vous trouverez django-countries soit sur sa page pypi soit sur sa page bitbucket. Pour l’installation, vous avez les trois moyens désormais classique : un easy_install un pip install un bon vieux hg clone La doc elle se limite à : la page pypi le readme du repository Sachant que dans les deux cas, le contenu est le même. Mais vu la simplicité de l’app, cela suffit amplement. 2- Mais au fait, à quoi ça sert ? L’app rajoute tout simplement un nouveau … -
Munin-like dashboard for Django websites
Django-utils has a pluggable dashboard app for building munin-like graphs. -
Wordpress to Django: Designing Compatible URLs in urls.py
As I mentioned in my previous post, there are a few fairly easy strategies for maintaining the stable URLs for your content when migrating from WordPress to a local Django driven blog. Django allows you a high level of control over URL formats so it's fairly simple to design them to be compatible with WordPress URLs. Additionally WordPress has been around long enough that the standard URL re-write formats follow suggested best practices for content, so bringing your Django URLs in alignment with that is not only useful for migrating content but good practice overall. That said the two most common formats for URLs in WordPress are: http://<domain>/<4 digit year>/<1 or 2 digit month/<1 or 2 digit day/<slug>/ so for example the URL for the previous post linked above is... http://www.flagonwiththedragon.com/2011/06/01/wordpress-to-django-strategies-dealing-with-WordPress-querystring-urls/ The next most common format for URLs is similar and differs mostly in how months are abbreviated: http://<domain>/4 digit year>/<3 char month>/<1 or 2 digit day>/<slug>/ So an example of the same URL above in this format would be... http://www.flagonwiththedragon.com/2011/jun/01/wordpress-to-django-strategies-dealing-with-WordPress-querystring-urls/ Designing urls.py in Django to accomodate this is simply: # URL format where month format is abbreviated character format. url(r'^(?P\d{4})/(?P\w{3})/(?P\d{1,2})/(?P[0-9A-Za-z-]+)/$', 'post_detail_alt'), url(r'^(?P\d{4})/(?P\w{3})/(?P\d{1,2})/$', 'post_day_alt'), url(r'^(?P\d{4})/(?P\w{3})/$', 'post_month_alt'), # URL format where … -
Getting prepaid mobile internet in NL
Getting prepaid mobile internet in NL UPDATE: when you register for the extra € 5 credit on My Vodafone, enter a (fake) Dutch address. One attendee was refused for registration when entering a foreign address, and was then refused for registration because his number was supposedly already registered. Coming to DjangoCon from abroad? Mobile roaming is usually expensive, so if you want to use internet on your phone, it’s best to get a Dutch prepaid SIM card. For € 7.50, you can get 1 GB data. Tethering is technically not allowed, but they probably don’t actively check for this. The only option with acceptable pricing are two different SIM types from Vodafone. Note: I have not tested these instructions myself. Use them at your own risk. This is all based on the Dutch Vodafone website. If you find any issues with them, please let me know :) What to buy Buy either one of these SIM cards: Vodafone Prepaid SIM only Meerwaarderen (€ 7.50). This includes € 10 credit but does not include any data. Not available in microsim. Vodafone Prepaid Smartphone Sim Only 1GB (€ 20). This includes € 10 credit and a 1 GB data package. Also available … -
Django "view-permissions" for related objects
You have a model A with a relation to another model B. In the Django admin, you have full permissions for model A and none for model B. However, if you create a new object for model A, you need to select a related object from model B. Tough luck: Permission denied! -
Allow squid/mod_wsgi to pass the HTTP_AUTHORIZATION header to Apache
-
Using Fabric to update a remote svn checkout with ssh public key authentication
-
Using mysql load data infile with django