Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
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 ... -
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. -
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 -
Django Project Setup Conveniences
Whenever I start a new Django project, there are several common steps that I to help standardize my setups. In settings.py...I define a PROJECT_ROOT variable which contains the path to the project directory. This is useful for various settings in the setup.py:import sys, osPROJECT_ROOT = os.path.dirname(__file__)I set my MEDIA_ROOT to be a path relative to the PROJECT_ROOT. Of course, I will need to create this directory on the filesystem. MEDIA_ROOT = os.path.join(PROJECT_ROOT, '..','htdocs','media').replace('\\','/') + '/'And I set a relative TEMPLATE_DIRS path. I will need to make this directory as well.TEMPLATE_DIRS = ( os.path.join(os.path.dirname(__file__), 'templates').replace('\\','/'),)Sometimes I add extra directories to the path so I can store specific packages within the project directory. (I might use this if I want to keep all related modules together).sys.path.insert(0, os.path.join(PROJECT_DIR, "contrib"))sys.path.insert(0, os.path.join(PROJECT_DIR, "src"))I generally like to put admin media in the following location: ADMIN_MEDIA_PREFIX = '/media/admin/'Almost all the time, I install the following modules in INSTALLED_APPS:'south', # django-south'django_extensions', # django-command-extensionsIn urls.py...If I want to use the Django debug server, I'll set this near the top:from django.conf import settingsurlpatterns = patterns('',)if settings.DEBUG: urlpatterns = patterns('', (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), ) -
Introduction
This blog will document my adventures in Django, the Python web framework. It is a direct fork of my Linux Info blog, but will be specifically utilized for documenting my Django activity. Though my aim is to post Django code and examples that are helpful, there will most certainly be better/different ways to approach various challenges. Any comments are much appreciated.Joe -
Django-nonrel – NoSQL support for Django | All Buttons Pressed
Django-nonrel – NoSQL support for Django. Liefert einen ersten Ansatz in Django verschiedene NoSQL Datenbanken zu integrieren, und zwar auf Ebene des Django-ORM. Backends für MongoDB (nein Danke), AppEngine und Cassandra sind in der Mache. Besonders Cassandra interessiert mich im Moment. -
Slides from my presentation at the Web Performance Meetup
-
Growl type notifications in Django
First, a little background Django has an excellent messages framework which provides support for cookie and session-based messaging, for both anonymous and authenticated users. The messages framework allows you to temporarily store messages in one request, and retrieve them for display in a subsequent request (usually the next one). Every message is tagged with a specific level determining its priority (e.g. success, info, error). For example, in a view you can send a message: from django.contrib import messages messages.success(request, "Profile details updated.") Then in the template you can display it, for example: {% for message in messages %} <li class="{{ message.tags }}">{{ message }}</li> {% endfor %} The Django admin interface displays messages in bar type fashion. I liked this implementation and copied it for the TurnKey Hub, with the added visual tweak of fading out the message bar after timeout (or when clicked). It's simple, minimal, and has worked well until now. But our needs are changing as the Hub is evolving. We need more flexibility and power. Our current implementation falls short in the following: Messages can't be specified as sticky (so they don't auto-close). Can't be programmatically created and closed for use via AJAX. Moves the whole page down, then up again (a little annoying). Limited … -
Growl type notifications in Django
First, a little background Django has an excellent messages framework which provides support for cookie and session-based messaging, for both anonymous and authenticated users. The messages framework allows you to temporarily store messages in one request, and retrieve them for display in a subsequent request (usually the next one). Every message is tagged with a specific level determining its priority (e.g. success, info, error). For example, in a view you can send a message: from django.contrib import messages messages.success(request, "Profile details updated.") Then in the template you can display it, for example: {% for message in messages %} <li class="{{ message.tags }}">{{ message }}</li> {% endfor %} The Django admin interface displays messages in bar type fashion. I liked this implementation and copied it for the TurnKey Hub, with the added visual tweak of fading out the message bar after timeout (or when clicked). It's simple, minimal, and has worked well until now. But our needs are changing as the Hub is evolving. We need more flexibility and power. Our current implementation falls short in the following: Messages can't be specified as sticky (so they don't auto-close). Can't be programmatically created and closed for use via AJAX. Moves the whole page down, then up again (a little annoying). Limited … -
Growl type notifications in Django
First, a little background Django has an excellent messages framework which provides support for cookie and session-based messaging, for both anonymous and authenticated users. The messages framework allows you to temporarily store messages in one request, and retrieve them for display in a subsequent request (usually the next one). Every message is tagged with a specific level determining its priority (e.g. success, info, error). For example, in a view you can send a message: from django.contrib import messages messages.success(request, "Profile details updated.") Then in the template you can display it, for example: {% for message in messages %} <li class="{{ message.tags }}">{{ message }}</li> {% endfor %} The Django admin interface displays messages in bar type fashion. I liked this implementation and copied it for the TurnKey Hub, with the added visual tweak of fading out the message bar after timeout (or when clicked). It's simple, minimal, and has worked well until now. But our needs are changing as the Hub is evolving. We need more flexibility and power. Our current implementation falls short in the following: Messages can't be specified as sticky (so they don't auto-close). Can't be programmatically created and closed for use via AJAX. Moves the whole page down, then up again (a little annoying). Limited … -
Merar – The Emerging Markets Investment Network v2.0 …
… or how we redesigned Merar`s website If you follow me on Twitter maybe you have noticed that a week ago(to be more precise 11th of March) I tweeted about the new version of Merar. Unfortunately it took me 9 days before I find some time to post about what we do and what we [...]