Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Presenting: django-simple-wiki
It was bothering me that all the wikis I tried, all had either errors, feature lacks, too many dependencies or were simply unmaintained. So I decided to create yet another one. Curiously, the third hit when googling ‘django wiki’ is Create a wiki in 20 minutes. Luckily that’s not really true, so all the PHP guys and MediaWiki can continue breathing. This took me several days. Google Code project page Demo website Hierarchy and relations First of all, as in the Trac wiki system, I chose to create a system for hierarchy, meaning that it’s possible to create an article and then create sub-articles. The hierarchy does not support multiple inheritance, because it needs to be basis for the permission system. That’s where the relation system comes in place: All articles can contain symmetrical relations to any other articles in the hierarchy. Parsing Python and Django supports Markdown pretty much out of the box, so it’s an obvious choice to use this for parsing. The HTML features of normal Markdown have been removed, so all HTML is escaped in django-simple-wiki. And parsing is static, so every time a revision is created, the contents are passed and stored. This means that … -
Database independent Django queries: COALESCE vs. NVL, IFNULL, ISNULL
Most of the time, it is not necessary to write raw SQL from Django. However, there are cases where it can’t be avoided. One common pattern in SQL that always comes up is to check two fields and get the value of the first non-NULL field. In Oracle I’ve used NVL and in MySQL I’ve […] -
Django powered AJAX Chat – Part 1
In the neverending adventure of developing our game website we have stumbled upon the “live chat” rock. I’ve seen some interesting things here using a pure django implementation for chat and there using django and comet for chat. I browsed the first one and I didn’t like it too much, and the comet implementation is clearly out of the picture for now. We have to finish this project in 4 to 6 weeks and we cannot take the risk of messing around with yet another technology (although I will keep this django+comet link bookmarked for future use). So I decided to make one quick and dirty chat app myself. I had a very clear idea of how I wanted to implement the chat, it is really simple after all: Client loads HTML + Javascript Client queries the Server every X seconds for new messages Server responds messages serialized in JSON format Client attaches new messages to the message box This does fail regarding performance, so I did a little bit of reading regarding the matter of creating html based chat applications. It turns out there’s this Comet model to allow persistent or long lived HTTP requests. The idea behind that … -
New Django Rpx
Rpx is a great sig in center. With RPX users can login using their facebook, openid, google, myspace, aol, yahoo, blogger, flickr and some other types of accounts. Some days ago I looked at django-rpx wich is pretty good but doesn´t cover som interesting rpx like mapping. Mapping allows a user to have multiple openids [...] -
robots.txt via Django, in one line
A significant difference between developing Django sites versus static-HTML-based approaches (among which I count PHP and the like) is that static files, aka "media", live in a dedicated spot. Sometimes you need a piece of static content to be available at a specific URL outside your media root. robots.txt for example. This can be done in pure Django (i.e. without even touching your Apache configuration), and is especially nice if your robots.txt content is short. The example below serves a basic "keep out" configuration. At the top of your root URLconf, add this import: from django.http import HttpResponse and below, among your list of URL patterns, add: (r'^robots\.txt$', lambda r: HttpResponse("User-agent: *\nDisallow: /*", mimetype="text/plain")) The lambda r bit is a concise way of creating a function object which accepts (and discards) the HttpRequest object that Django provides to all views. The "mimetype" setting (aka "content_type" in Django 1.0) is important too, because robots don't like text/html. So there you have it -- a classic one-line (plus an import) robots.txt solution. -
Festival Latino-americano de Instalação de Software Livre
Venho através deste convidá-los ao FLISOL/RN 2009. O Festival Latino-americano de Instalação de Software Livre do RN irá acontecer no dia 25 de abril de 2009 no SENAC em Natal. No evento eu irei ministrar um mini-curso introdutório ao framework Django das 14:00 as 17:00 horas, cujo objetivo é formar pessoas com conhecimentos básicos acerca [...] -
GSoC: Implementation of additional i18n features on Django
Here you have my proposal for Google Summer of Code 2009. It was approved previous week, and I'll be working on it during this summer. The problemWhile Django provides an amazing system to translate texts, and displays localized dates in some parts of the admin; it has many data that could be internationalized, not it's not yet. The information that developers should be able to localize/translate is mainly: All dates and related information (times, calendars...) All numbers (mainly decimal ones) Texts (and any data in general) saved on the database More information on these issues can be found in the following blog post and this ticket: http://vaig.be/2008/07/django-i18n-status.html http://code.djangoproject.com/ticket/7980 Proposal The proposed solution for improving Django i18n includes several different tasks. Those tasks are: Import locale data from CLDR Apply i18n to Django dates and times Apply i18n to Django numbers Allow translating content on the database Fix already reported bug about i18n Next are the details for every task. Note that all those specifications are subject to change, according to discussions with the mentor of the project, Django core developers team, and the main Django community. Importing locale data The main repository of locale data is the Common Locale Data … -
Django Local Server Slow?
Downgrading to a Vista machine, each HTTP request on my local django (development) webserver was taking more over a second to respond, which forced me to look for solutions. Here is a quick compilation of answers I found and what worked for me:My DB was on a remote machine, so first I copied the DB to my desktop. Result: Bad idea, it wasn't the bottleneck. "Change localhost to 127.0.0.1". Result: Didn't help me, but perhaps it would resolve a possible DNS conflict / misconfiguration. "Disable your virus scanner". It makes perfect sense as virus scanners present further processing for every HTTP request. It apprently has helped many, but did nothing for me. "Remove '::1 localhost' from your hosts file'. On windows its located "C:\windows\system32\drivers\etc\hosts". Result: Success! Everything was fast again.Other solutions I didn't try include:Stop using VistaUpgrade your Vista to the latest service packOn Firefox "switch off ipv6". -
Run Django Tests from TextMate
It would be cool to be able to run my Django tests from within TextMate. Update: this version will run just the tests from the active file, if there are any. Otherwise, it runs all of the tests in the whole project. Here is a Command to do just that: {% highlight ruby linenos %} #! /usr/bin/env ruby command = [ENV["TM_PYTHON"] || "python", "-u", "#{ENV['TM_PROJECT_DIRECTORY']}/manage.py", "test", "--noinput"] File.open(ENV['TM_FILEPATH']) do |f| f.readlines.each do |line| if line =~ /class (.*)\(.*TestCase\):/ test_case = $1 app_name = ENV['TM_FILEPATH'].split(ENV['TM_PROJECT_DIRECTORY'])[1].split('/')[1] test_name = "#{app_name}.#{test_case}" command << test_name end end end require ENV["TM_SUPPORT_PATH"] + "/lib/tm/executor" ENV["PYTHONPATH"] = ENV["TM_BUNDLE_SUPPORT"] + (ENV.has_key?("PYTHONPATH") ? ":" + ENV["PYTHONPATH"] : "") TextMate::Executor.run(command) do |str, type| if type == :err if str =~ /\A[\.EF]*\Z/ str.gsub!(/(\.)/, "\1") str.gsub!(/(E|F)/, "\1") str + "\n" elsif str =~ /\A(FAILED.*)\Z/ "#{htmlize $1}\n" elsif str =~ /\A(OK.*)\Z/ "#{htmlize $1}\n" elsif str =~ /^(\s+)File "(.+)", line (\d+), in (.*)/ indent = $1 file = $2 line = $3 method = $4 indent += " " if file.sub!(/^\"(.*)\"/,"\1") url = "&url=file://" + e_url(file) display_name = file.split('/').last "#{htmlize(indent)}" + (method ? "method #{method}" : "at top level") + " in #{display_name} at line #{line}\n" end end end {% endhighlight %} -
Hollywood Draft Private League Launch!
This new game allows you to play in a more traditional fantasy game model where you draft from a pool celebrities. This allows fun things like draft parties, benching players and all the regular things those familiar with fantasy sport already know. Give the game a spin with a few friends and let me know what you think! Hint: If you're really into fantasy sports, this is a great game to play with your girlfriend to let her feel involved. -
Building Better Web Services With Django (Part 2)
In the first part I talked about using the Content-Type and Accept HTTP headers to allow a single website to be use both by humans and programs. In the previous part I gave a decorator which can be used to make working with JSON very easy. For our use though this isn’t great because a [...] -
MyEmailDraft.com Launched!
The site solves one simple problem. Messy email based fantasy drafts. Our goal was to make something as simple to setup as an email draft but without any of the downside. If you're into fantasy games and have done an email draft before, some of the problems with email drafts are: ♦ Email storm. Everyone does a reply-all so you get emailed on every pick. ♦ Users forget they are up because they start ignoring emails (see email storm). ♦ Emails start to look like this. Making it very difficult to find what was picked and make your own pick. ♦ Some users forget "reply all" thereby leaving it up to the one person that got the email to continue the draft. ♦ Creating a random draft order is a big pain for the league owner. Once you enter all the email address, just as you would into your email program, you're ready to go. The league home page is all AJAX based so it refreshes on its own to give you status updates and lets you make picks quickly using a very light interface. Of course, you can still make picks via email and the system will automatically handle those too. No login\password is … -
dojo.beer in Amsterdam and Munich
Some of the dojo guys are traveling around the world, and we are happy to get Pete Higgins, Dylan Schiemann and Nikolai Onken together for a couple of dojo.beers. 1) Amsterdam, 27th April, 19:00 – the first one will be already next week in Amsterdam on Monday the 27th April, this will be a meetup in a restaurant and probably a lot of tech and geek talk and some beer. 2) Munich, 9th May, all day – the second one will be a free full-day event in Munich with talks and time to hang out and hack together. It will take place on the 9th May, starting at around 12:00 in the rooms of the SKYTEC AG (Keltenring 11, 82041 Oberhaching). Amsterdam, 27th April Detailed information All the following info are from the dojocampus.org post. The first dojo.beer() in The Netherlands will be held on April 27th in Amsterdam. Hopefully this will be the beginning of a series of fun Dojo events bringing people from The Netherlands and around together, who work with Dojo, enjoy using Dojo and like everything around the Web. As a special guest we will have both Dylan Schiemann (SitePen, Dojo Co-Founder) and Peter Higgins (Dojo … -
More buildout notes
I got a lot of great feedback on my buildout tutorial I posted last week. In general, the comments there have some excellent tips, tricks, and extra pointer, so check ‘em out. After reading the comments and a few more I got over email, I thought I’d share a selected grab-bag of updates, hints, and details for those fooling around with Buildout and Django. Django trove identifier James Bennett pointed out that Django has its very own PyPI classification, Framework :: Django. -
Nashvegas Issues
GitHub has added integrated issue tracking: So, in an effort to sample this awesomeness, I have converted my TODO file to issues for Nashvegas. Please vote on the ones you care about and enter new ones that would be helpful for you. -
Nashvegas Issues
GitHub has added integrated issue tracking: So, in an effort to sample this awesomeness, I have converted my TODO file to issues for Nashvegas. Please vote on the ones you care about and enter new ones that would be helpful for you. -
Installing GeoDjango with PostgreSQL and zc.buildout
The installation of the PostgreSQL requirements is somewhat daunting. I've spent a bit of time putting together a buildout.cfg to try to make this easier. -
Installing GeoDjango with PostgreSQL and zc.buildout
I've been wanting to play with GeoDjango for a while, since my database of choice (PostgreSQL) has excellent spatial support. However, getting all the dependencies up and running is pretty complicated. I've been working on a buildout to get at least most of the steps done for you. There are a couple of manual steps at the end, which I hope to automate when I next have time to work on this. The buildout installs the following items: PostgreSQL PostGIS GDAL Proj GEOS psycopg2 Django It should also perform initial setup of the PostGIS database template, loading some sample SQL files, and sets up some convenience symlinks for the PostgreSQL command-line programs. It's not finished - in particular, it just assumes that the user running the buildout is to be used as the database owner and such like. Anyway, here it is: [buildout]parts = postgresql postgis gdal init-pgsql pgsql-symlinks django eggs = psycopg2[postgresql]recipe = zc.recipe.cmmiurl = http://wwwmaster.postgresql.org/redir/198/h/source/v8.3.7/postgresql-8.3.7.tar.gzextra_options = --with-readline --enable-thread-safety [postgis]recipe = hexagonit.recipe.cmmiurl = http://postgis.refractions.net/download/postgis-1.3.5.tar.gzconfigure-options = --with-pgsql=${postgresql:location}/bin/pg_config --with-geos=${geos:location}/bin/geos-config --with-proj=${proj:location}[proj]recipe = zc.recipe.cmmiurl = http://download.osgeo.org/proj/proj-4.6.1.tar.gz[geos]recipe = zc.recipe.cmmiurl = http://download.osgeo.org/geos/geos-3.0.3.tar.bz2[gdal]recipe = zc.recipe.cmmiurl = http://download.osgeo.org/gdal/gdal-1.6.0.tar.gzextra_options = --with-python --with-geos=${geos:location}/bin/geos-config[init-pgsql]recipe = iw.recipe.cmdon_install = trueon_update = falsecmds = ${postgresql:location}/bin/initdb -D ${postgresql:location}/var/data -E UNICODE ${postgresql:location}/bin/pg_ctl -D ${postgresql:location}/var/data … -
Installing GeoDjango with PostgreSQL and zc.buildout
I've been wanting to play with GeoDjango for a while, since my database of choice (PostgreSQL) has excellent spatial support. However, getting all the dependencies up and running is pretty complicated. I've been working on a buildout to get at least most of the steps done for you. There are a couple of manual steps at the end, which I hope to automate when I next have time to work on this. The buildout installs the following items: PostgreSQL PostGIS GDAL Proj GEOS psycopg2 Django It should also perform initial setup of the PostGIS database template, loading some sample SQL files, and sets up some convenience symlinks for the PostgreSQL command-line programs. It's not finished - in particular, it just assumes that the user running the buildout is to be used as the database owner and such like. Anyway, here it is: [buildout]parts = postgresql postgis gdal init-pgsql pgsql-symlinks django eggs = psycopg2[postgresql]recipe = zc.recipe.cmmiurl = http://wwwmaster.postgresql.org/redir/198/h/source/v8.3.7/postgresql-8.3.7.tar.gzextra_options = --with-readline --enable-thread-safety [postgis]recipe = hexagonit.recipe.cmmiurl = http://postgis.refractions.net/download/postgis-1.3.5.tar.gzconfigure-options = --with-pgsql=${postgresql:location}/bin/pg_config --with-geos=${geos:location}/bin/geos-config --with-proj=${proj:location}[proj]recipe = zc.recipe.cmmiurl = http://download.osgeo.org/proj/proj-4.6.1.tar.gz[geos]recipe = zc.recipe.cmmiurl = http://download.osgeo.org/geos/geos-3.0.3.tar.bz2[gdal]recipe = zc.recipe.cmmiurl = http://download.osgeo.org/gdal/gdal-1.6.0.tar.gzextra_options = --with-python --with-geos=${geos:location}/bin/geos-config[init-pgsql]recipe = iw.recipe.cmdon_install = trueon_update = falsecmds = ${postgresql:location}/bin/initdb -D ${postgresql:location}/var/data -E UNICODE ${postgresql:location}/bin/pg_ctl -D ${postgresql:location}/var/data … -
Installing GeoDjango with PostgreSQL and zc.buildout
I've been wanting to play with GeoDjango for a while, since my database of choice (PostgreSQL) has excellent spatial support. However, getting all the dependencies up and running is pretty complicated. I've been working on a buildout to get at least most of the steps done for you. There are a couple of manual steps at the end, which I hope to automate when I next have time to work on this. The buildout installs the following items: PostgreSQL PostGIS GDAL Proj GEOS psycopg2 Django It should also perform initial setup of the PostGIS database template, loading some sample SQL files, and sets up some convenience symlinks for the PostgreSQL command-line programs. It's not finished - in particular, it just assumes that the user running the buildout is to be used as the database owner and such like. Anyway, here it is: [buildout]parts = postgresql postgis gdal init-pgsql pgsql-symlinks django eggs = psycopg2[postgresql]recipe = zc.recipe.cmmiurl = http://wwwmaster.postgresql.org/redir/198/h/source/v8.3.7/postgresql-8.3.7.tar.gzextra_options = --with-readline --enable-thread-safety [postgis]recipe = hexagonit.recipe.cmmiurl = http://postgis.refractions.net/download/postgis-1.3.5.tar.gzconfigure-options = --with-pgsql=${postgresql:location}/bin/pg_config --with-geos=${geos:location}/bin/geos-config --with-proj=${proj:location}[proj]recipe = zc.recipe.cmmiurl = http://download.osgeo.org/proj/proj-4.6.1.tar.gz[geos]recipe = zc.recipe.cmmiurl = http://download.osgeo.org/geos/geos-3.0.3.tar.bz2[gdal]recipe = zc.recipe.cmmiurl = http://download.osgeo.org/gdal/gdal-1.6.0.tar.gzextra_options = --with-python --with-geos=${geos:location}/bin/geos-config[init-pgsql]recipe = iw.recipe.cmdon_install = trueon_update = falsecmds = ${postgresql:location}/bin/initdb -D ${postgresql:location}/var/data -E UNICODE ${postgresql:location}/bin/pg_ctl -D ${postgresql:location}/var/data … -
Ajax Validation Aministrivia
Small administrative note, now that Github has it's own issue tracker users wishing to report issues with django-ajax-validation can now do so on Github, instead of the old Google Code page. Django-filter users can also report issues on its Github page, in place of the former system of "message or email me", which, though functional, wasn't very convenient. -
Developing Django apps with zc.buildout
Developing a Django app with zc.buildout Over the weekend I put together django-shorturls, the latest in a series of small plugable Django apps I’ve written. This time, though, I used zc.buildout and djangorecipe to build, test, package, and distribute the app, and (with the exception of a few annoyances) it’s an exceedingly civilized way to develop an app. In the interest of helping improve Buildout’s still-nascent documentation, I documented my steps along the way. -
How to make the Django 500 (server error) view useful
Django is pretty awesome. It comes with a lot of view functions built-in. One of these functions is the 500 (server error) view. Quoting the Django documentation for the 500 view: Django executes special-case behavior in the case of runtime errors in view code. If a view results in an exception, Django will, by default, call [...] -
Nobody expects Python packaging!
Python has one package distribution system: source files and setup.py install. And easy_install. Python has two package distribution systems: setup.py install and easy_install. And zc.buildout. Python has three package distribution systems: setup.py install, easy_install, and zc.buildout. And pip. Amongst Python’s package distribution are such diverse elements as… -
Sum for the range of a column in Excel
Working on my current project, one requirement came out which made me all the more appreciative of django's nice array of built-in filters. I generated an Excel report for my clients which is generated from html. Good and nice. Then one of them said, hey can the Excel report have a row which outputs the sum of the whole column of say the column E? Something usual and easy in Excel but stumped me for a while of how to do it from html to excel. For the most part it was trying to figure out how to include that SUM formula at my html code. A little visit to M$ support center got me the help I needed and then it was back to nice plethora of filters django has .... Turns out that you can include formula into a cell (or a table column in this case) by simply doing something like this '=SUM(E2:E70)' just after the opening tags for your column. This part actually took the longest for me as I did not really know how to do it correctly. My last row in this case was dynamic because it depended on the number of rows generated …