Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Displaying High Resolution Images on the Web with Zoomifyer.
I recently wrote an article, due to be published in this month's Information Technologies and Libraries (ITAL) journal, about a project I started a few years ago called Zoomify Image. Basically, Zoomifyer is a Flash based image viewer that allows you to quickly view high resolution images over the Web. And I mean really high resolution images--files Gigabytes in size. It can do this because of a second piece of software that pre-processes images on the server, splitting them into tiles at various scales that the Zoomifyer viewer can then asynchronously request as needed to render the image in the browser. Zoomify Image is written in Python and makes Zoomifyer available across platforms. -
CZ | Django 0.96
Django má další pre 1.0 release. Jedná se o verzi 0.96, která zahrnuje dosud dělané změny v SVN:Testovací nástroje - dá se přímo psát testy založené na doctest nebo unittest, testovat pohledy (views) a automaticky natahovat testovací dataVerze 0.96 obsahuje také nové moduly pro formuláře - django.newforms., které nahrazují starý validační framework django.formsPříjemné úpravy v URL mapovánía samozřejmě další...Django 0.96 je propracovanější, než 0.95, ale já osobně stále doporučuji používat velice stabilní trunk ze SVN. -
My Dreamhost + Django + Subversion Setup
Since I haven’t put out a technical article in a while, this blog will explain how I’ve setup Dreamhost + Django + Subversion to play nicely together in a seamless development environment via a shared hosting provider. Hopefully – someone, somewhere can find this information useful and insightful in their own development environment. The very first thing I did was unleash my first Django web application on Dreamhost. Thanks to an excellent tutorial from Jeff Croft, a detailed explanation about FastCGI contained within the Django documentation, and a few helpful pointers on the Dreamhost wiki, I was able to get my application deployed in a matter of a few hours. You can check it out here! However, after going through Jeff’s excellent tutorial, I still wasn’t completely satisfied with my Django deployment on Dreamhost. Something was missing. There wasn’t a seamless way to continue development on my home machine, deploy to a test environment, and still keep my live site intact. After all, I’m a true believer in the open source dictum of ‘release early, release often‘, and without a way to test my application on a live server, I wasn’t happy with my configuration management. Ideally, I envisioned having … -
Ajuste inteligente do settings.py
Com essa dica, teremos dois arquivos de configuração que revezam entre versão de desenvolvimento e produção, o arquivo local_settings.py contém nossa configuração de desenvolvimento, assim não precisamos nos preocupar com settings.py na hora da distribuição, pois settings.py sabe quando deve dar passagem as configurações do arquivo local_settings.py. -
Convertendo a documentação do Django em HTML
A documentação do Django é escrita em formato reST (ReStructured Text). Então podemos gerar páginas HTML para uma leitura mais divertida, o script build_documentation.py é quem faz isso em djangoproject.com e pode fazer para você também, você só precisa criar um arquivo settings.py na mesma pasta do script contendo as variáveis DJANGO_DOCUMENT_ROOT_PATH e DJANGO_TESTS_PATH que indica onde estão seus arquivos reST e o diretório de testes do Django respectivamente .Conteúdo de settings.py:DJANGO_TESTS_PATH='/home/wiliam/dev/django/tests'DJANGO_DOCUMENT_ROOT_PATH='/home/wiliam/dev/django/docs'Dicas:Rode o comando svn update antes para atualizar seu código.Mantenha separados os arquivo .txt dos arquivos .html, crie uma pasta html dentro da pasta doc do Django e modifique build_documentation.py nas linhas 50 e 51 para fiquem com um + 'html' apos DJANGO_DOCUMENT_ROOT_PATH:50 - out_file = os.path.join(settings.DJANGO_DOCUMENT_ROOT_PATH + 'html', os.path.splitext(fname)[0] + ".html")51 - toc_file = os.path.join(settings.DJANGO_DOCUMENT_ROOT_PATH + 'html', os.path.splitext(fname)[0] + "_toc.html") -
Django e o quebra cabeça com newforms
Basicamente temos duas formas para usar o newforms a primeira consiste em usar as funções form_for_model() e form_for_instance(), para a primeira função você deve passar a classe que define seu modelo e para segunda você passa a instância desta classe e o newforms encarrega-se de gerar o formulário para você. Na segunda forma você define seu formulário como uma classe que herda de Form. Considere a definição do modelo abaixo:class Product(models.Model):..description = models.CharField(maxlength=200)..category = models.ForeignKey(Category)..quantity = models.IntegerField()..cost = models.FloatField(max_digits=10, decimal_places=2)..detail = models.TextField(maxlength=400, blank=True)Usando form_for_model:>>> from django import newforms as form>>> from warehouse.models import Product>>> ProductForm = form.form_for_model(Product)>>> pf = ProductForm()>>> print pf.as_table() # retorna nosso formulário como tabela, em branco.Usando form_for_instance:>>> from django import newforms as form>>> from warehouse.models import Product>>> p = Product.objects.get(pk=1)>>> ProductForm = form.form_for_instance(p)>>> pf = ProductForm()>>> pf.as_table() # retorna nosso formulário como tabela, com valores.Acompanhe agora a segunda forma de uso do newforms. O método __init__ serve para carrega todas as categorias disponíveis no banco. Considere a definição do formulário abaixo:class ProductForm(forms.Form):..def __init__(self, *args, **kwargs):....super(ProductForm, self).__init__(*args, **kwargs)....self.fields['category'].choices = [('', '----------')] + [.......(c.id, c.name) for c in Category.objects.all()]..description = forms.CharField(max_length=200)..detail = forms.CharField(max_length=400)..category = forms.ChoiceField(choices=())..quantity = forms.IntegerField()Testando 123:Mesmo conceito usado com form_for_model:>>> from warehouse.forms import ProductForm>>> pf = … -
Django permissões
O Django tem um esquema de autenticação onde podemos definir diferentes permissões, todos os modelos definidos em models.py por padrão tem três add, change e delete. No exemplo abaixo temos um modelo Pessoa como um único campo nome e através do uso do atributo permissions da classe Meta definimos duas novas permissões dirrigir_carro e dirrigir_moto.models.py:class Pessoa(models.Model):..nome = models.charField(maxlength=30)..class Meta:....permissions = (......("dirigir_carro", "Pode dirigir caro"),......("dirigir_moto", "Pode dirigir moto"),......)Quando definir novas permissões não esqueça de atualizar a base de dados usando o comando python manage.py syncdb. Podemos checar por permissões de duas maneiras diferentes, veja abaixo:views.py:def moto(request):..if request.user.has_perm('empresa.dirigir_moto'):....return HttpResponse("Você pode dirigir moto.")..else:....return HttpResponse("Tire sua carteira de moto antes")@permission_required('empresa.dirigir_carro')def carro(request):..return HttpResponse("Voce pode dirigir carro.")A função moto usa request.user.has_perm() para checar se o usuário tem permissão, a parte antes do .dirigir_moto é o nome da aplicação e não o nome da classe "Pessoa". Usando uma função como essa você pode redirecionar o usuário para uma página de mais erro explicativa.A função carro usa o decorator @permission_required() para checar por permissão e em casso negativo redireciona para página de login normalmente /accounts/login/. -
Evolving a RESTful Django Contribution
I posted an announcement to the django-users list about the django-restful-model-views contribution to get some feedback on the approach. The main responder, Malcolm Tredinnick, gave me a lot to think about and along with more research into how Ruby on Rails (RoR) implements REST, I have new ideas about how to improve the contribution. -
Circles of Django (2007)
So here’s a question I get asked a lot: “How big is Django’s community?” Anyone who works in open source knows that it’s basically impossible to know the size of any open source community. It’s easy with commercial programs – just look at the sales numbers – but since F/OSS is freely (and widely) available, there’s almost no way to know how many people are using your project. Still, the tie-wearing enterprisy business folks ask these types of questions, and it’s useful to have an answer ready. -
Portuguese translation of Django in the trunk
The Portuguese(pt_PT) translation of Django is now in the trunk. svn co http://code.djangoproject.com/svn/django/trunk/ -
Portuguese translation of Django in the trunk
The Portuguese(pt_PT) translation of Django is now in the trunk. svn co http://code.djangoproject.com/svn/django/trunk/ -
EN | Console on Windows without Admin rights
I am working in the corporate environment. And based on the fact that I am not in the corporation structure set in the boxes of developers, I have quite limited access to the functionality of my Windows notebook even though I work in IT. Highly limited access. I cannot even run commands from the command line. To be fair, though, this is quite common practice, which saves time to my fellow IT colleagues when something gets broken. On the other hand it highly limits me, when some tasks can be done quickly using commands from the command line.How is this related to Django?Believe me or not, it is much faster (read less stressful) for me to setup a small running intra-web application in 2 hours than asking several committees to approve the project to actually build the same. So I love Django and Python for these quick, dirty, and as I stress to everyone, temporary solutions. And believe me, as I am from IT department, when I say temporary, it really gets wiped out at the set date.When managing Django one needs to run commands from the command line quite often. Therefore having command line access is pretty useful.So the … -
Portuguese translation of Django
I've submitted the Portuguese(pt_PT) translation of Django, meanwhile you can download the unofficial version in the downloads section. -
Portuguese translation of Django
I've submitted the Portuguese(pt_PT) translation of Django, meanwhile you can download the unofficial version in the downloads section. -
Test Driving a RESTful Django Contribution
This time around, I will try to take the logical next step with my exploration of REST and Django, and begin creating a Django contribution to implement the ideas I have been working on and to do so in a way that fits with Django's philosophy. -
You vs. the Real World
“Be liberal in what you accept.” dummy_thread » entry.bozo » req.assbackwards » UnicodeDammit » x possibly equals y » -
django REST redux
This is the third post in a series exploring how to create a basic tagging application, and how to do so in the Django framework so that I may better understand Django as well as other technologies and development approaches that are at least somewhat new to me. This time, I want to revisit REST, and hopefully come up with something more usable from the last post. -
Jimbo's Number
It’s been a bad new year for Wikipedia, and it’s probably just going to get worse. While watching such a noble experiment come apart at the seams is depressing, it seems there’s a pretty valuable lesson here: Jimbo’s Number 1,000,000 — the approximate maximum size, in pages, of any one website. -
Ripped by Engadget
What a fun morning. The Daily Python-URL carried a link to an Engadget story featuring a picture of the OLPC from PyCon (Ian Bicking’s badge is visible in the background). Hey, doesn’t that picture look familiar? Yup, that’s right: Engadget ripped me off. That photo’s licensed under a CC BY-NC license, meaning that even if you pretend that Engadget’s use is non-commercial (on an ad-driven site it’s hard to say, really), without attribution they’re essentially guilty of plagiarism. -
Five things I hate about Python
Inspired by Titus (who was in turn inspired by brian d foy), here’s what I hate about Python. I completely agree with Brian that you can’t trust any advocate who doesn’t know enough to find stuff to hate. Given that I spend a lot of time advocating Python, writing down what I hate seems a good exercise. Perhaps I’ll do the same for Django in the future… Anyway, here are the five things I hate about Python, presented Letterman-style: -
toward a RESTful approach to Django applications
If you've read my blog in the past, and you probably haven't, you'll know that I have been trying earnestly to understand how to effectively apply REST, both in Web applications and Web Services. I also believe that you can't claim to know something, and judge it fairly, until you have used it in a significant project. That is what I intend to begin in this post. -
Helping Sort Django's Error Emails
When you run a Django powered website with debugging turned off, whenever a condition happens that would cause a HTTP 500 Error (such as an uncaught exception), the administrators receive an e-mail with a traceback and other relevant details to help debug the issue. These e-mails are really, really handy … -
Helping Sort Django's Error Emails
When you run a Django powered website with debugging turned off, whenever a condition happens that would cause a HTTP 500 Error (such as an uncaught exception), the administrators receive an e-mail with a traceback and other relevant details to help debug the issue. These e-mails are really, really handy. If however you run multiple Django sites, all with Debugging turned off, it can become difficult to tell which emails and errors relate to which site. There are two solutions: Write perfect code that never throws errors; or Get Django to prefix the subject of the error e-mails so you can tell what belongs where. Since there are only 24 hours in a day (most of which when I'm either sleeping or at my non-Django day job which pays the bills) I've opted for #2. And doing that is easy. All you need to do is set the EMAIL_SUBJECT_PREFIX variable in settings.py: EMAIL_SUBJECT_PREFIX = '[myproject] ' Easy as pie! -
PyCon 2007 pictures
I published first day pictures from PyCon 2007. They are raw, unedited, I didn't put descriptions yet. You can recognize Django guys, people from multiple Python web frameworks, and, of course, the BDFL with OLPC. But why wait for pictures to be prepped? Dig in while they are raw and fresh: Yes, this is Steve Holden sporting a Django t-shirt.Update: I added pictures from the 2nd day.Update #2: I added pictures from the 3rd day. Now I can go and put some names and descriptions like I did last year. -
PyCon 2007 pictures
I published first day pictures from PyCon 2007. They are raw, unedited, I didn’t put descriptions yet. You can recognize Django guys, people from multiple Python web frameworks, and, of course, the BDFL with OLPC. But why wait for pictures to be prepped? Dig in while they are raw and fresh: Yes, this is Steve Holden sporting a Django t-shirt. Update: I added pictures from the 2nd day. Update #2: I added pictures from the 3rd day. Now I can go and put some names and descriptions like I did last year.