Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Building My Django Weblog: Part 6.5
All of a sudden, more than a month has passed and I have not added any new entries. I've been working on and off on a markdown extension to handle abbr and acronym tags. So far it simply refuses to work (the code doesn't even seem to get executed). For the curious: import re, markdown, random class AcronymExtension (markdown.Extension): def __init__ (self, configs) : self.config = configs def extendMarkdown(self, md, md_globals) : self.md = md ABBR_RE = re.compile(r'\[(.+?)\]\{([^{]+?)\}') ACRONYM_RE = re.compile(r'\[([^\]]*)\]\{\{([^}]+)\}\}') md.inlinePatterns.append(AcronymPattern(ABBR_RE, self.config)) # md.inlinePatterns.append(AcronymPattern(ACRONYM_RE, self.config)) class AcronymPattern (markdown.BasePattern) : def __init__ (self, pattern, config) : markdown.BasePattern.__init__(self, pattern) self.config = config def handleMatch(self, m, doc) : abbr = doc.createElement('abbr') abbr.appendChild(doc.createTextNode(m.group(1))) abbr.setAttribute('title', m.group(2)) return abbr def makeExtension(configs=None) : return AcronymExtension(configs=configs) if __name__ == "__main__": import doctest doctest.testmod() So, in the meanwhile, I'm not able to deliver on my promise to talk more about microformats. However, if you're astute, you've noticed that the tag cloud on these pages has changed. John Buchanan recently released a distutils-enabled version of django-tagging. He's implemented both the features I requested, which makes me greatly happy. I've added the first feature to this site already. Now, when you click on a specific user's blog, you will see … -
Washington Post and Facebook Platform Development
A little over a week ago, my group at WPNI was involved in developing an application for Facebook's latest version of their platform. If you haven't yet heard about this, Facebook Platform now lets developers create full blown Facebook applications just like Facebook's own Photos, Events, and Notes applications. Any developer can create any kind of application which can run on Facebook itself. Our first application is called The Compass. (You must be a Facebook user to view or use the app.)Rob does a much better job than I ever could of explaining the ideas, the creative process, and the Compass itself. I thought I would try to add a little on the technical aspects of the app, specifically the Facebook/washingtonpost.com intergration, deploying on Django, and server performance issues from the Facebook traffic.Facebook PlatformFacebook has had a developer's API since late last year. This API allowed developers outside of Facebook a way to create web or desktop applications that could integrate data from Facebook's social network. A Facebook user could go to a website I created, and given the proper Facebook credentials, login to my site and have some or all of their social data from Facebook follow them. For … -
Going International, pt. 4: Middleware and context processors
Following up to the part 3 of my series about implementing a multilingual interface for this blog, I now present the things to make the language-magic happen: Middleware and context processors. Disclaimer When I wrote this code, I wasn't aware of the threadlocals pattern. In the next iteration of the code, I'll make use of it. For now, it works good enough so it stays. Views, part 2 Those who read carefully or tried to use the code I posted on my previous post, would notice that I was referencing request.url_lang, which of course would lead to an error, since it's not obvious on when and where it's set. So let's present this: Middleware Here's a little helper function that does this: re_language = re.compile(r'^/(?P<lang>[a-z]{2})/.*') def put_language(request): m = re_language.match(request.path) if m: lang = m.group('lang') request.url_lang = lang #print request.url_lang else: raise Exception() return None You can see that it uses a regular exception, so it's trivial to set it up to suit different needs. Now we have another problem, that our URLconfs and views would have to be aware of this URL scheme, and it would make it tedious. So, we go and rewrite request.path like this: class LanguageMiddleware: … -
Some guesses about the future
There’s a fun thread over at Poynter’s Online News mailing list about what the future might hold for digital journalism. I thought I’d post my contributions here as well: Steve Yelvington: For a project I’m working on, I’d be interested in projections, predictions or complete wildass guesses about the near future. Say, 2012, just five years from now. Hey, this sounds fun! Here are mine: The iPhone – that is, the iPhone and the millions of knock-off devices – changes everything. -
Django and Crontab: Best Friends
For a while I know I’ve needed to figure it out, but I finally had to actually do it today. ... -
One rule to bind them - part II
In part I of this article I tried reducing the number of steps a user was required to perform to get a system installed via jumpstart and addressed a couple of the goals I mentioned in Building a manageable jumpstart infrastructure using the Solaris Security Toolkit.My ultimate goal was to reduce steps 1 through 5 and selecting from the build menu to a single interaction such as entering the -
I cut myself on Django's bleeding edge
I just updated the django code to the latest revision, and a whole host of errors broke up... Luckily, I found the culprit fast here. Google is my friend indeed :) Comments -
Problem with django feed
I fell into the obligatory problem where non-public items leak out to public feeds. Sorry to everyone, I've updated the feed. The root of the problem was not using the custom public Manager I have created to deal with this problem in the django-tagging application. It accepts only Model classes. I'll probably hack it up to suit my needs... Comments -
Beware: Python markdown limitations
I use markdown to edit the posts in this blog, using the python markdown library. However, I discovered a nagging problem that will cause to me switch away, to something like ReST. This is an issue that dates back to 2006, and it's very annoying for blogs. You can't put images inside links! This means that the often-used thumbnail image that links to the full-sized original image, has to be done in plain old HTML, which sucks. Here's an example: This should render the google logo linking to google: [![the google logo][logo]][google] [logo]: http://www.google.com/images/logo.gif [google]: http://www.google.com/ "click to visit Google.com" But instead it renders (Actual output): [][google] Source [<img src="http://www.google.com/images/logo.gif" alt="the google logo"/>][google] (Taken from here) Disclaimer: This is about the Python engine of markdown. Other implementations of markdown work fine, as far as I can tell. So, should I just bite the bullet and switch to ReST ? Comments -
Book: From Java To Ruby
Friday night I very quickly read Bruce Tate's From Java To Ruby. By quickly, I mean to say I read it sitting in Borders because I sure wasn't going to part with the $55 (AUD) / $45 (USD) price Borders AU had whacked on a $29 (USD) book - the PDF version is only $20 (USD) so I'll snaffle that for reference. As a reformed Java programmer (and reformed C programmer one paradigm before) in a kinda/sorta evangelizer role, I really appreciate that someone - anyone - would take the time to write this book. In clear, management friendly language (sans cringe and thus palatable to developers), Tate lays out the case for Ruby by bringing both strengths and weaknesses into context. It runs something like this: * Java (and interchangeably .NET) are inherently complex... * Rarely do your problems require such complexity... * There is another way that's cheaper, faster and easier... * For everything else you've still got Java. Ok, so the argument is a touch more nuanced than that, but if you want it word perfect go buy the book ;) I think it's a great thing for proponents of pragmatic development to rally behind Ruby: A … -
He shoots, he scores!
Adrian Holovaty just scored big. Congrats, Adrian! Your work on Django and realted projects is definitly appreciated. Post to Del.icio.us -
SliceHost Recommendations for Django
Today I received an email about my recommendations for hosting Django sites on SliceHost. Below is the letter, then my ... -
Django projects
I’ve always thought that the sign of a healthy Open Source project is a vibrant ecosystem around that project. That’s why I’ve been thrilled to see that there are a bunch of cool third-party Django add-ons popping up. I thought I’d take a few minutes and give a shout out to some of my favorites. django-openid OpenID evangelist and Alpha Geek Extraordinare Simon Willison wrote this set of tools which lets your Django application become an OpenID consumer. -
Django Quick Tips #1.5: Manager Methods
In Django Quick Tips #1 I briefly discussed how using custom managers helps reduce the amount of code you’ll write. ... -
Django Newforms
Eu estava escrevendo um post completo sobre o newforms do django, quando eu vejo que eles atualizaram a documentação no site oficial hoje. E vários assuntos que estava abordando e que não tinham na documentação agora estão lá. Por isso vou deixar este post engavetado quietinho, quem saiba ainda precise dele?Mas para quem quer aprender ou saber mais sobre newforms ai vai umas dicas:A documentação oficial pode ser acessada aqui -> http://www.djangoproject.com/documentation/newforms/Na documentação oficial, aborda os seguintes temas:arquitetura do newforms que é formada por fields, widgets e forms.criação, validação e exibição dos formulários em html. criação de formulários a partir de um existente usando herança.documentação sobre os fields (novo)geração de formulários através do model ou instância.Há coisas que ainda não tem documentação como personalização de formulários gerados através de um modelo ou uma demonstração de como um model por interferir num form gerado pelo newforms, mas isso eu posso mostrar em outros posts.Abaixo alguns links sobre newforms que valem a pena serem lidos.http://pythonidae.blogspot.com/2007/03/django-e-o-quebra-cabea-com-newforms_27.htmlhttp://weblog.bignerdranch.com/?p=31http://eggdrop.ch/blog/2007/02/15/django-dynamicforms/http://code.pui.ch/2007/01/07/using-djangos-newforms/http://www.zoia.org/blog/2007/04/23/using-dynamic-choices-with-django-newforms-and-custom-widgets/http://unpythonic.blogspot.com/2007/01/django-newforms-for-models.htmlhttp://www.pkshiu.com/loft/archive/2007/04/custom-validation-in-django-newforms-library -
I have a Slice and you don't
I have a Slice and you don’t (probably)! SliceHost has quickly outgrown themselves and have a wait list of up ... -
Going International, pt. 3: Implementation of multilingual content
Introduction As I wrote in the two previous posts, I wanted the URLs of this site to contain the language the content is in. To do this, I had to write some custom code, including models, managers, middleware and context processors. Models The first step on having multilingual content is to define a model that can support it. I thought long and hard and it boils down to these conclusions: The same content in different languages shares some data, like the slug, the tags and the publication date The different data are the title, the summary and the body. Therefore, I have to find a way to "inherit" the shared data to the actual entries, while keeping the different data apart. Model inheritance in Django is somewhat rough, and so I went with KISS: Keep it simple, stupid, and went with the simplest thing that might just work: First, define a master entry: class MasterEntry(models.Model): slug = models.SlugField( unique_for_date='pub_date', prepopulate_from=('title',), help_text='Do not add language info here.' ) pub_date = models.DateTimeField() tags = TagField() enable_comments = models.BooleanField(default=True) class Meta: ordering = ('-pub_date',) get_latest_by = 'pub_date' class Admin: list_display = ('pub_date', 'slug') list_filter = ('enable_comments', 'pub_date') search_fields = ['slug','tags'] date_hierarchy = 'pub_date' … -
Going international, pt. 2: URL design
To help myself developing the international part of this blog, I've made some usage scenarios, which I write down here, partly to not forget them but mostly to help find any mistakes and omissions. So here they are: The users: Giannis (Greek, computer savvy user, has his browser correctly set) Takis (Greek, lives abroad, doesn't have access to the language settings) I could also define two English users in similar situations, but there's no point as it turns out that they just mirror each other. I have to point out a seemingly little-used preference of web browsers, the language selection preference. This sets the HTTP header 'Accept-Language' so that a server can know, erm, the language preference. This is basic stuff but not many users bother to change from the default setting. URLs and design The pages: /el/1/ Direct link to a greek page, content isn't available in english. /en/2/ Direct link to an english page, content isn't available in greek. /el/3/ Direct link to a greek page, content is available in english. /en/3/ Direct link to an english page, content is available in greek. Also, there are two little flags on the top right of the site that allow … -
djanger = Django developer
Durante uma conversa com o Marinho, onde estávamos falando sobre a falta de sistemas em django, como cms, blogs, wikis e acabou saindo uma nova expressão: djanger, onde djanger é a pessoa que utiliza o django.Sent at 12:22 PM on SaturdayAndrews Medina: heheh verdade :pMarinho Brandão: … e ir oferencendo o serviço a djangers (essa expressão eu acabei de inventar… ehhe ) e ganhar dinheiro com AdSenseNessa conversa tambem nasceu um novo projeto o 'bingo!'. Ainda não sei se será esse nome mesmo, mas em breve terão notícias sobre ele. -
Lançado o Bingo!
Depois do anúncio aqui está o lançamento. Este ainda não é o lançamento oficial, mas já está disponível no google code o código fonte do bingo. Para quem não sabe o bingo é um CMS desenvolvido em django. O blog, wiki, feeds RSS e atom já estão em funcionamento, mas há várias coisas a serem resolvidas, como os comentários e cadastro de usuários. Para as tags usamos o django-tagging. O marinho, meu parceiro no desenvolvimento do bingo colocou uma versão do bingo no ar para ver acesse http://marinho.webdoisonline.com/blog/. Também foi criado um grupo de discussão para o grupo de desenvolvimento do bingo. Se quiser participar é só se inscrever. O e-mail do grupo é bingo-developers@googlegroups.comSó lembrando que ainda não foram lançadas nenhuma versão release, mas em breve lançaremos o 0.1.Para acessar o código fonte do bingo via svn use:svn checkout http://bingo.googlecode.com/svn/trunk/ bingo -
CMS em Django? bingo!
Depois de um tempo de pesquisa concluí:Ao contrário das outras tecnologias, não há nenhum CMS, Wiki ou algum sistema do tipo feito em django.Se pensarmos em zope, pensamos em plone. Se pensarmos em php logo vem wordpress, phpnuke, phpbb. Se pensamos em java temos o JavaBB, JavaFreeCms entre outros.Mas porque não há nada parecido em django?Uma das razões é porque é tão facil criar um wiki no django que ninguem vai querer um pronto.Foi ai que decidi: vou criar um CMS feito em django e seu nome será bingo.O bingo integrará Wiki, Blog, Galeria de fotos, feeds entre outras coisas.O grande barato do bingo é que o foco dele não serão somente os djangers, e sim pessoas comuns que querem ter seu wiki ou seu blog ou páginapessoal, sem precisar mexer nos códigos.Mas, quando anuncei o bingo! na lista de e-mails do django-brasil, muitos djangers se interessaram, e ainda mais, se alistaram para ajudar o projeto. E ainda mais o site da comunidade django-brasil usará o bingo!.O bingo! ainda é um projeto em nascimento, mas já nasceu com o pé direito.Está querendo ajudar? Está ancioso para utilizar?Aguarde..... -
Mais um site feito em django com o fonte liberado!!!
Tá virando mania mesmo!Tudo começou quando o JeffCroft resolveu liberar o código fonte de uma projeto que ele tinha feito em django o LOST-theories.com. Esse foi seu primeiro projeto em django. Mesmo com o grande crescimento da comunidade OpenSource e com a idéia de que algo assim poderá ajudar muitos a aprenderem a fazer o que você sabe, podendo ajudar a comunidade estarem bem difundidos, ainda é raro vermos algo assim.Lógico que tem projetos opensource em várias linguagens são faceis de achar, como o Drupal por exemplo. Mas liberar o código fonte de um site comercial, só para mostrar como foi feito é algo que não se vê todo dia.Muita gente viu e curtiu! E o resultado disso foi mais dois sites repetirem o ato: o CheeseRater e o DjangoSnnipets.org.Vendo a ação feita pelo pessoal do DjangoSnnipets, o Chris McAvoy liberou através do google code, um projeto para podcasts em django.Nisso já são 4 projetos, um vendo o outro e seguindo o exemplo. Isso me faz lembrar do filme: 'A corrente do bem'.Agora falta só você também fazer parte dela ( e eu também né ).A comunidade django agradece!Ai estão o link para os fontes dos projetos:http://code.google.com/p/tastebud/http://code.google.com/p/cab/ http://code.google.com/p/django-registration/http://www.cheeserater.com/ ( o … -
Enfim o django 0.96
Dia 23 de março foi anunciado no blog oficial do django o lançamento da versão 0.96 do django.O objetivo principal dessa versão é deixar estável, algumas coisas que foram iniciadas na versão 0.95 e nisso haverá incompatibilidades na mudança de versão.A principal incompatibilidade está relacionada ao driver para MySQL, o MySQLdb. Se a versão que você utiliza for anterior a 1.2.1p2, você terá que colocar no settings 'mysql_old' em vez de 'mysql', se a versão do driver for a 1.2.1p2 ou mais recente continua a mesma coisa.Como muitos ja esperavam, o newsforms que é a nova biblioteca para geração e manipulação de formulários é a padrão. Se você quiser continuar usando os oldforms é só importar os oldforms como forms da seguinte maneira:from django import oldforms as formsEntre as outras novidades está:Uuma ferramenta para testes.Melhoria na parte de serialização, com novos formatos, suportando JSON, XML e Python ( gerando listas, dicionários, strings )Melhorias também na configuraçã ode URLs, antes só era permitido strings com o caimnho inteiro indicando uma função duma view, agora é possível importar essa função com o import do Python e apenas chamá-la. Ex:from django.conf.urls.defaults import *from mysite.myapp.views import myviewurlpatterns = patterns('', ('^myview/$', myview))E para finalizar foram … -
Django + Apache no Windows
Com a crescente divulgação do django aqui no Brasil, muitos estão começando a testar e usar esse WebFramework.A maioria dos desenvolvedores usam o 'manager.py runserver' para fazerem seus testes com django no windows, ou por falta de necessidade de usaru m servidor para testes ou por não conseguir configurar um.No post de hoje vou mostrar a instalação e configuração do Django em ambiente Windows utilizando apache + modpython.Os programas utilizados são:Python 2.4.4Apache 2ModPython 3.2.8Django 0.95.11 - Instalando o PythonPara instalar o Python no Windows é só dar duplo clique no arquivo .msi e seguir o guia de instalação2 - Instalando o ApachePara instalar oapache no windows é só dar um cuplo clique no executável e seguir o guia de instalação.Para testar o apache é só acessar http://localhost3 - Instalando o modpythonPara instalar o modpython é só dar um cuplo clique no executável e seguir o guia de instalação. No final da instalação é só informar a pasta em que o apache foi instalada.Depois abra o arquivo 'http.conf' que fica dentro da pasta 'conf' do apache e adicione esta linha:LoadModule python_module modules/mod_python.so4 - Instalando o djangoDescompacte o arquivo .tar.gz baixado no site do django.Abra o prompt de comando, geralmente encontrado em … -
Captcha no django
Você quer evitar spams em seus sistemas feitos em django?Seus problemas acabaram! Existe um projeto opensource da verificação capctha para django. Este projeto utiliza os newforms o que é algo muito bom, já que a maneira antiga de tratar formulários no django tende a ser extinta.Para saber mais sobre o projeto acesse: http://www.lostlogicx.com/captchasblow/