Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Issues using django-compress and django.contrib.staticfiles from django 1.3
There is no way to use both django-compress and django.contrib.staticilfes from new django 1.3. MEDIA_URL and MEDIA_ROOT hardcoded into django-compress utility functions so here ismy fork of django-compress on github with fix.I've added two new settings COMPRESS_URL and COMPRESS_ROOT which points by default to MEDIA_URL and MEDIA_ROOT respectively for backward compatibility.django-compress is extremely useful tool which provide possibility to organize your JavaScript and CSS files around your project. Also there is a couple of useful features like support of YUI compressor and building of bunch of JavaScript or CSS files into one.Read more about django-compress -
direct_to_template generic view class-based replacement for django 1.3
I was in love with direct_to_template shortcut from django.views.generic.simpleUpdate: It was my lack of attention to the docs. new render shortcut do the same thing as code belowIt's extremely useful to use direct_to_template instead of render_to_response because there is no necessary to put RequestContext to direct_to_template shourcut. But now it's deprecated so I decided to replace it with small class-based view which do same thing as old direct_to_template but – without restriction of new TemplateView where is no way to put extra context.from django.views.generic.base import TemplateResponseMixinfrom django.template import RequestContextclass RenderTemplate(TemplateResponseMixin): """django 1.3+ Class-Based replacement for django.views.generic.simple.direct_to_template Usage: context = {} return RenderTemplate.view(context, \ request=request, template_name="main.html") """ @classmethod def view(cls, context, render_args={}, **initkwargs): obj = cls() for key, val in initkwargs.iteritems(): setattr(obj, key, val) return obj.render_to_response(context, **render_args) def render_to_response(self, context, **kwargs): return super(RenderTemplate, self)\ .render_to_response(RequestContext(self.request, \ context), **kwargs) -
Upgrading to Django 1.3?
Should you upgrade to Django 1.3? Upgrade any web framework in your application in general? Try this decision chart here http://www.djangopro.com/2011/03/should-i-upgrade-to-django-1-3/: -
Deploying to ep.io with secret stuff
hej -
Deploying to ep.io with secret stuff
hej -
Django Dynamically Generated Images with Cairo
It is fairly simple to dynamically generate images in your Django views using the Cairo 2D graphics library. -
2009 Django Dash Complete
The 2009 Django Dash is done. The site (http://alt.djangodash.com/) has the full commit logs and some interesting stats (overall, per team, per dasher). I'll do a better post-mortem tomorrow. Congratulations to all who participated and hope to see you next year! -
Postmortem: Django Dash 2009
Now that the Dash is over, I wanted to write up a little postmortem with some thoughts about how things went. To understate things, this year's Django Dash was amazing. In virtually every regard, the competition exceeded last year's contest. What Went Well First, a huge thanks to the sponsors. We went from 8 last year to 12 this year. Without them, there would be no prizes for the contest. We also doubled the number of teams that actively competed, which really impressed me. Many of the entries seem much more complete than last year as well. Using IRC & Twitter were also big wins. The IRC channel (#django-dash on Freenode) was where the party was most of the weekend (thanks to Eric for setting it up and admin'ing it). And being able to more easily/effectively distribute information via Twitter was nice (less infrastructure/headaches for me). Plus it was fun watching the #djangodash fly by. More stats and sparklines improved the website itself. I used the jquery.sparkline library and the new Aggregation support in Django trunk (soon 1.1), both of which proved easy to use and made it a little easier to spectate the contest. Bumping the team size from … -
Haystack 1.0.0-rc1
Haystack 1.0.0-rc1 -
Haystack 1.0 Final Released
Haystack 1.0 Final Released -
Better Local Settings
Better Local Settings -
Comentário sobre configurando um projeto django no uol host – terceira parte por thiago
Olá, Estou tentando colocar no servidor da uolhost um projeto em django. no site da uol indica criar o projeto dentro da pasta publica, fiquei com receio de fazer dessa maneira. A hospedagem é uma revenda, ou seja no mesmo ftp tem outras pastas de outros sistemas, no caso desse projeto ficou "sitedjango.com" e dentro do ftp existe uma pasta exclusiva para esse site home\usuario\sitedjango coloquei nessa pasta o projeto, e na pasta home\usuario\sitedjango\public_html coloquei a pasta media. Dentro da pasta home\usuario\sitedjango inclui o arquivo .htaccess com a configuração PythonPath "['/home/drdg/Django-1.3', '/home/usuario/sitedjango'] + sys.path". O problema é que o apache não esta aceitando a configuração quando entro no site do projeto aparece a msg "Verifique se algum dos arquivos index.html ou index.php existem no diretório /public_html", já viu esse erro antes? -
Authorize.Net Credit Card Form in Django
This Django form will submit credit card data to a payment gateway such as Authorize.Net when the form is validated. If the payment is not accepted then the error response from the payment gateway is added to the form's non field errors as shown in the image to the left. This is a follow to yesterday's post, Accept Credit Cards in Django with Authorize.Net, in which I introduced a very simple example using the quix.pay Python module to process credit cards in a Django project. This moves the payment gateway request into the Form object rather than the view. It also moves some of those configurations into your typical Django settings. At some point in the future a finalized version of this technique may be packaged and released by Quixotix Software (open-source of course) but in the mean time I thought I would share you how you might implement this on your own. The nice thing about this approach is that the view becomes much more simple and failures from the payment gateway are added to the forms' errors. So let's look at what the view looks like first. View from django.template import RequestContext from django.shortcuts import render_to_response from django.http … -
A lightweight task queue for Django
It's quite common when building out a website to trigger actions during the normal request/response cycle that may be time-consuming. Examples of these actions might be: sending email, for example a contact form checking a comment for spam by sending to Akismet thumbnailing an image I remember last year about this time my coworkers and I got pretty excited about Celery, a distributed task queue, that provided a really nice API for executing tasks out-of-process. Basically just decorate functions with the @task decorator and so long as everything is configured properly, they will execute out of process. Celery is an actively-developed project with great documentation and an incredibly rich feature-set, but all those features come with the added cost of lots of configuration and the need for integration with a number of projects (celery, django-celery, kombu, django-kombu, pyparsing, mailer). I needed a lightweight task queue for some side-projects and rather than trying to integrate all the various celery dependencies (and pinning all the correct versions) I did what anyone would do: rolled my own. -
Caktus 2011 Summer Internship Program
I'm excited to announce that Caktus is launching its summer internship program. It is a 12 week paid position in our Carrboro, NC office. We're in driving distance from UNC Chapel Hill, NC State in Raleigh, and Duke in Durham, so students from all parts of the NC Research Triangle are welcome to apply.We are ... -
Blog Posts Via Email With CloudMailin.com
I recently learned (with horror) that a co-worker wrote her blog posts in Gmail, copied the rich text to WordPress, then copy and pasted the generated HTML into our Markdown-enabled blog backend. To be fair, our nerdy authoring tool is a bit much for non-technical users and doesn't really fit into most "normal" workflows. Additionally, she emails her posts to an internal list so Gmail was a natural authoring tool. There had to be some common ground we could find; blog posts still written in Markdown while allowing her to use Gmail to write her posts. Our solution was to enable post-by-email on the blog. By adding a special email address to the recipients, the message is parsed into Markdown, a draft post is created, and she receives an email reply a few seconds later with a link to edit the new post. From there she can review and publish it in a few clicks resulting in a much improved workflow. We wanted the draft posts created immediately and I didn't care to be polling a mail server every few seconds. Fortunately, we found a new service that made this project incredibly easy to implement. CloudMailin.com CloudMailin.com is a fantastic … -
Accept Credit Cards in Django with Authorize.Net
Accepting credit cards in your Django applications using the Authorize.Net payment gateway is easier than you might think. Using the quix.pay Python module to do the heavy lifting with Authorize.Net, all you need to get started is a simple Django form. You will need to either download quix.pay and install it using the setup.py script or download and install quix.pay using the easy_install command: easy_install quix.pay The quix.pay Python module provides credit card processing using online payment gateways including Authorize.Net. For those who are interested, I wrote up a more detailed look at quix.pay here: Authorize.NET Payment Gateway in Python You should also have the "API Login ID" and "Transaction Key" for your Authorize.Net merchant account or developer account. This would have been provided to you by Authorize.Net when you signed up. The Django code below shows a very simple credit card form. Along with the amount to charge the credit card, this is the minimum data you need to pass along to Authorize.Net (depending on your account security settings). from django import forms class PaymentForm(forms.Form): first_name = forms.CharField(max_length=50) last_name = forms.CharField(max_length=50) card_number = forms.CharField(max_length=16) expiration_month = forms.CharField(max_length=2) expiration_year = forms.CharField(max_length=4) security_code = forms.CharField(max_length=4) This next snippet of Django code … -
7 SEO Tips for your Django Site
“It is legal because I wish it.” – Louis XIV, France Forget content. When it comes to the Internet, Google is king. If you please the king, you can do well. If you cross the king, your disloyal ass will be thrown into the tower to watch your site wither and die, unless the king deigns to sets you free. Some of the things that most please the king are “thick” (i.e. not “thin”) content pages, well structured site navigation, and honest links to and from your site. In building my new site, Wantbox.com, I’ve both pleased and inadvertently crossed the king. The problem with this monarch: he doesn’t speak to his subjects, so if you end up in the tower, you’re never quite sure why. Your best strategy is to know the rules of the kingdom, and do your best to follow them. Below are some of the best practice, white-hat SEO techniques that I have used to make sure the king stays happy. 1) Automatically NOINDEX “Thin” Pages, Part 1 As I write this post, I’m mentally air-quoting the word “thin” because nobody knows for sure how “thin” is defined. For me, I’ve arbitrarily decided that a page … -
Django 1.3 lançado
Django 1.3 lançado -
Django 1.3 lançado
Django 1.3 lançado -
LFS on DjangoCon Europe
LFS sprint We are going to sprint at DjangoCon Europe in Amsterdam from June 9th to 10th, 2011. The conference will take place from 6th to 9th 8th. If you consider to attend please add your name to the list of participants. You are also encouraged to add your preferred topics. The sprint locations will be open 48-hours non stop. This will allow us to hacking like hell. We are looking forward to see you all at this year's DjangoCon Europe. More information http://www.getlfs.com http://lfsproject.pbworks.com/ -
Automatically create new revisions of django model on save.
I have a use case I am investigating where saving an object should mark the original object as deleted, and save a new copy. Using django, this is suprisingly easy to achieve. Here is a simple model that does just that: {% highlight python linenos %} from django.db import models class AutoSave(models.Model): name = models.CharField(max_length=64) active = models.BooleanField(default=True) previous = models.ForeignKey('AutoSave', null=True, blank=True, related_name='subsequent') def save(self, *args, **kwargs): if self.pk: self.previous_id = self.pk AutoSave.objects.filter(pk=self.pk).update(active=False) self.pk = None super(AutoSave, self).save(*args, **kwargs) {% endhighlight %} The important bits are that there is a boolean field called active, which can be used to soft-delete, as well as to indicate that this is the most recent revision of an object. There is also a reference to the previous version. When an object is saved, we look for an existing primary key. Django uses this to determine if we are doing an INSERT or UPDATE. We want to get a reference to the current revision, then update the database version of that revision to be inactive, and then ensure the current data will create a new database record. This is obviously a bit of a simplification, but the only way I would change it might … -
Querying ManyToMany fields in Django…
… or how to select items that have one or more categories matching with other item categories The problem: having a Many To Many relation(ManyToManyField) is really useful when you have to link one object to many other. For example one artist may play in several styles, or a teacher can teach more than one [...] -
Django 1.3 is out - time to upgrade!
Nearly a year in the making, Django 1.3 is now shipping. It includes a ton of bugfixes along with a bunch of major new features: Class-based views. Better support of Python’s logging tools. A new tool to help with handling static files. Greatly improved testing utilities via the unittest2 library. Configurable on-delete behavior. And more! To help people get a jump on upgrading, I'll be holding a webinar next week. We'll talk about the new features, go over the steps to follow for a safe and easy upgrade, and cover the "gotchas" to avoid as you upgrade. You should join us — March 31 from 1-3 (central). It'll be a blast. -
Django Environment Quick Setup
aptitude install python-virtualenv # for debian-based systemsvirtualenv --no-site-packages myprojectcd myproject/source ./bin/activatepip install django south django-extensionspip install flup psycopg2mkdir -p ./etc/ ./var/log/ ./app/django/cd ./app/django/django-admin.py startproject mymain