Django community: Community blog posts RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
djangotidbits.com
This started out as a simple extension of my blog over a year ago. It was called snippets at the time, and it was merely a project to learn. I also had built a simple paste bin, which was my first django project, with the same purpose. I finally decided to rip the snippet app out of my blog, rename it to tidbits, and try to build it out on it’s own. From start to finish, it was both exciting and frustrating, I learned a whole lot about python, django and even myself. I’m proud to give you djangotidbits.com. Some of the key features are, revisions, multi-source view, and bulk source upload. -
Personalizar el título del sitio de administración
¿Te has cansado del monótono título "Administración de Django" que aparece en el sitio de administración de tu proyecto? Django permite personalizar las plantillas del sistema de administración fácilmente. Puedes tener plantillas de administración personalizadas a nivel de modelo, aplicación o proyecto... -
Sprint de Django en el PyCamp Argentina 2009
Por el blog de Ramiro Morales me entero de que desde hoy día 21 hasta el 24 tiene lugar el PyCamp Argentina 2009 en Los Cocos, en Córdoba (Argentina). Parece que se han puesto las pilas y se va a realizar un sprint de Django durante el evento: http://www.python.com.ar/moin/PyCamp/2009/TemasPropuestos/SprintDjango Esperemos que la comunidad Argentina de Python se entusiasme con Django y sean muchos los que participen ;) -
Snippet de vista para i18n
Una vista genérica para escoger el idioma a través de una url y ser redirigido al punto en el que se encontraba el usuario. -
Snippet de vista para i18n
Una de las cosas que nos ofrece django es vistas genéricas y soporte para localización (aka i10n) e internacionalización (aka i18n). Entonces una vez tenemos nuestro sitio con i18n o i10n pues lo que sigue es que le demos a nuestros usuarios la manera de escoger su idioma, django tiene un algoritmo par esto, sin embargo en algún punto nuestros usuarios querrán poder escoger su idioma preferido, para esto este framework nos da la opcion de una vista generica, sobre la cual encontrarán información en http://docs.djangoproject.com/en/dev/topics/i18n/#the-set-language-redirect-view.Lo único es que esta vista espera que halla un formulario para que el usuario escoja su idioma y además que tengamos predefinida una página a la cual el usuario será redirigido después de seleccionar el idioma a lo cual le veo particularmente un inconveniente pues si el usuario ha llegado a un punto importante para él y es llevado a la página inicial pues no le agradará (en mi caso me molestaría), además si queremos tener la posibilidad de hacerlo desde una url y no una variable por post?Para resolver este conflicto se modifica un poco la vista que nos trae django y la dejamos así:def set_lang(request,lang): response = HttpResponseRedirect(request.META['HTTP_REFERER']) lang_code = u'%s' % … -
Reffering to Django docs from your docs using Sphinx
Sphinx is a great documentation tool, and one of it’s built-in extensions is sphinx.ext.intersphinx. It simply takes your objects references for other projects and converts to links in the other project’s documentation. In sphinx-quickstart command, it asks if you want to add this extension. If so, It adds this code to your conf.py file: extensions [...] -
Beautiful Soup and Memory Issues
After a few days of work, I finally reached a preliminary release of the little scraping project I mentioned before. I wanted to test this version on my production server, so I deployed it, and immediately started seeing some weird parsing issues with Beautiful Soup. My local work environment and my production server are the same, so usually deployments go smooth, but this time the same code, running on the same version of Python, with the same Ubuntu distribution, was giving different results. After a little bit of digging around, I decided that it has to be related to memory, since my virtual hosting environment is pretty limited in terms of RAM. I was running a very simple Beautiful Soup parser before: from BeautifulSoup import BeautifulStoneSoupfrom urllib import urlopen response = urlopen(url) soup = BeautifulStoneSoup(response.read(), convertEntities=BeautifulStoneSoup.HTML_ENTITIES) lines = soup.findAll("li") Run locally, this was giving me all li items on the page. Run on the server, it was giving me only a subset, usually only three or four. It was annoyingly random behaviour at best. After reading Beautiful Soup’s documentation on how to improve performance, I decided to use custom Soup Strainers to only parse parts of the document: from BeautifulSoup import BeautifulStoneSoup, SoupStrainerfrom … -
Patch to Django Extensions
I am really loving the django-extensions project, especially the sync_media_s3 command to move my media to be hosted on Amazon S3. I find it increasingly useful when combined with django-compress. However, I ran into a snag today where I wanted to only sync to s3 my compiled scripts from django-compress, instead of my entire MEDIA_ROOT. Therefore, I added the a patch to add a --dir optional parameter to the command. -
Patch to Django Extensions
I am really loving the django-extensions project, especially the sync_media_s3 command to move my media to be hosted on Amazon S3. I find it increasingly useful when combined with django-compress. However, I ran into a snag today where I wanted to only sync to s3 my compiled scripts from django-compress, instead of my entire MEDIA_ROOT. Therefore, I added the a patch to add a --dir optional parameter to the command. -
Another strange django unicode error solved!
Today while trying to my final product to one of our customer's an ugly little error shot back at me when I tried editting any of the imported records into the database. "django ascii codec can't encode ..." bla bla it would complain and refuses to render the said template. Tracking down the problem down, I found it to the __str__ method being returned one of my models. After changing the database encoding for my MySQL database ( sucky on windoze ), it still stubbornly spat back the same error at me. Finally after searching around more I found the smart_str method's usage here. Kudos! It works now. So instead of returning the normal 'str(self.name)' I do a 'smart_str(self.name)' and everything is back to it's hunky doriness! -
ifequal
More late-nite hacking. Tonight I needed this little nugget: class IfEqualNode(Node): def __init__(self, var1, var2, nodelist_true, nodelist_false, negate, parser=None): self.var1, self.var2 = Variable(var1), Variable(var2) self.nodelist_true, self.nodelist_false = nodelist_true, nodelist_false self.negate = negate self.parser = parser def __repr__(self): return "<" + "IfEqualNode>" def render(self, context): try: val1 = self.var1.resolve(context) except VariableDoesNotExist: val1 = None # crazy ghf patch filter_expression = self.parser.compile_filter(self.var1.var) vn1 = self.parser.create_variable_node(filter_expression) val1 = vn1.render( context ) try: val2 = self.var2.resolve(context) except VariableDoesNotExist: val2 = None # crazy ghf patch filter_expression = self.parser.compile_filter(self.var2.var) vn2 = self.parser.create_variable_node(filter_expression) val2 = vn2.render( context ) if (self.negate and val1 != val2) or (not self.negate and val1 == val2): return self.nodelist_true.render(context) return self.nodelist_false.render(context) def do_ifequal(parser, token, negate): bits = list(token.split_contents()) if len(bits) != 3: raise TemplateSyntaxError, "%r takes two arguments" % bits[0] end_tag = 'end' + bits[0] nodelist_true = parser.parse(('else', end_tag)) token = parser.next_token() if token.contents == 'else': nodelist_false = parser.parse((end_tag,)) parser.delete_first_token() else: nodelist_false = NodeList() return IfEqualNode(bits[1], bits[2], nodelist_true, nodelist_false, negate, parser) def ifequal(parser, token): """ Outputs the contents of the block if the two arguments equal each other. Examples:: {% ifequal user.id comment.user_id %} ... {% endifequal %} {% ifnotequal user.id comment.user_id %} ... {% else %} ... {% endifnotequal %} """ … -
Django i18n status
Here you have what, from my point of view, is the status of django i18n. Comments will be very welcome, specially from people from countries with other i18n needs than mine (based on the idea that Django i18n is perfect for people in the US, here is the troubleshooting for my country, for sure more problems exists for people in for example China).This list is part of the analysis that I'm doing to fix all those problems. If you want to participate in making Django also "The web framework for perfectionists outside the US", please contact me.SubjectCommentsTranslation (static content)YesDjango has an amazing translation system, easy to use, and exceptionally automated. Also it has bidi support. Despite of this, some problems can be found when translating django or applications to other languages (masculine/femenine...).Translation (database content)NoDjango doesn't support model field translation, but it can be achieved using an external application such as TransDb, django-multilingual, django-utils translation service and i18ndynamic. As far as I know only TransDb and django-multilingual are working on Django's trunk.Calendar customizationNoPatching Django is required to change first day of week in admin calendar (first day of week is Monday according to ISO and in many countries (most Europe, most … -
Documenting Django pluggable apps with Sphinx
I decided to document my Django projects with the same tool used by Django team: Sphinx. It is a very good documenting tool, and was used for many other projects, including the Python Project itself. But it has a simple problem with Django, that I found the solution rlazo’s blog. But it still has some [...] -
Novos pacotes relacionados ao django no debian
Segundo notícia publicada por Daniel Watkins em seu blog, novos pacotes de aplicativos Django foram adicionados ao Debian, entre eles: django-tinymce, fornece o widget TinyMCE para uso em forms e em views django-filebrowser, que adiciona uma interface para gerenciamento de arquivos dentro do próprio admin do django. django-contact-form, que como o próprio nome já diz, provê uma forma fácil de criar formulários de contato. Por enquanto, os pacotes estão disponíveis apenas no Debian Unstable. -
Selecting Web Hosting
I've been interested in finding out what it takes to attract traffic to a site and what type of money it draws in with Google's Adsense program. So along with building a website I'm also going to learn python and django to develop the site. So recently I've been spending some of my free time going through django tutorials and writing small applications to get the hang of python. I've also discovered not to enter python into a browser and push ctrl-enter at work because python.com is very different from python.org. What I found while performing the initial implementation and developing a basic blogging application is that it's not the python and django programming where I ran into most of the problems rather all of the setup of apache, the database, finding web hosting, etc. The following is going to be talking about my experience searching for a good host for my django applications. My initial criteria when selecting a company to provide hosting is first to be inexpensive. This criteria was key since I'll be primarily using the hosting for a blog and any experimentation so I didn't want to start dumping buckets of money into this project. Along … -
Еще один
isagalaev@isagalaev:~$ curl -is http://afisha.yandex.ru/ | grep Server: Server: lighttpd / Pony Powered! Вот! Подробности позже. И, наверное, даже не у меня... -
Еще один
isagalaev@isagalaev:~$ curl -is http://afisha.yandex.ru/ | grep Server: Server: lighttpd / Pony Powered! Вот! Подробности позже. И, наверное, даже не у меня... -
Google Moderator for PyCon ORM Panel
I'm going to be moderating a panel this year at PyCon between 5 of the Python ORMs(Django, SQLAlchemy, SQLObject, Google App Engine, and web2py). To make my job easier, and to make sure the most interesting questions are asked I've setup a Google Moderator page for the panel here. Go ahead and submit your questions, and moderate others to try to ensure we get the best questions possible, even if you can't make it to PyCon(there will be a recording made I believe). I'll be adding my own questions shortly to make sure they are as interesting as I think they are.Also, if you aren't already, do try to make it out to PyCon, there's still time and the talks look to be really exceptional. -
New Django Site: Brite Revolution
Josh Kersey announced tonight a new site built by the folks at Cabedge and it appears to be done in Django. I love seeing fresh ideas, especially concerning digital media. I have long thought the music industry just doesn't get the last 5 to 10 years of technological innovation and public mood shift. Now, I am not industry expert, but I don't think it takes a wizard to see that Apple has single handedly been disruptive in this area. Couple that with the ability for individuals to produce very high quality recordings in their basement cheaply and then leverage social media and the Internet to distribute their music. The game has changed. Brite Revolution is the first thing I have seen that is formerly recognizing that and building a business model around it. From their About page: Artists need to be able to make music again without going into debt or losing ownership of their music. Fans need more music from their favorite artists on a regular basis and feel like a part of an event again. Philanthropic organizations need more opportunities to connect directly with people to make a difference in the world. To top it all off, they … -
New Django Site: Brite Revolution
Josh Kersey announced tonight a new site built by the folks at Cabedge and it appears to be done in Django. I love seeing fresh ideas, especially concerning digital media. I have long thought the music industry just doesn't get the last 5 to 10 years of technological innovation and public mood shift. Now, I am not industry expert, but I don't think it takes a wizard to see that Apple has single handedly been disruptive in this area. Couple that with the ability for individuals to produce very high quality recordings in their basement cheaply and then leverage social media and the Internet to distribute their music. The game has changed. Brite Revolution is the first thing I have seen that is formerly recognizing that and building a business model around it. From their About page: Artists need to be able to make music again without going into debt or losing ownership of their music. Fans need more music from their favorite artists on a regular basis and feel like a part of an event again. Philanthropic organizations need more opportunities to connect directly with people to make a difference in the world. To top it all off, they … -
Join us a djangopeople.net!
Hey, I just stumbled upon a nice “social” site called djangopeople.net. It’s a site listing people who use Django, along with some interesting contact information. As the site says (when i signed up): Django People lists 4116 Django developers from around the world, in 110 different countries. The aim of the site is to help Django developers find like-minded souls near them, and hopefully kick-start some local meet-ups and user groups. Come us and join the party! -
The low-down on Django-Techblog
I figured I would write-up some of the features of Django Techblog, the blogging application I wrote to power this site. It does most of what you would expect from a blogging app, but there are a few features that it does differently. The main difference is extended markup, but there are a couple of other features that worthy of note: Multi-blog capable. I want to blog on a variety of subjects, but because some of the things I post about (namely the geeky stuff) are only of interest to a select few, I risk turning away visitors who aren't interested in those techy posts. Categories and tags are one solution to this, but I prefer to have a number of blogs under an umbrella blog, each with its own posts, templates and tags. In Techblog, there is also a concept of a channel which appears exactly like a blog from the front-end, but aggregates posts & tags from one or more blogs. In this site, the home-page at / is actually a channel consisting of /blog/tech/ and /blog/personal.Microblogging. Techblog has support for Twitter and potentially other microblogging services could be added. You add your twitter account details, which Techblog … -
The low-down on Django-Techblog
I figured I would write-up some of the features of Django Techblog, the blogging application I wrote to power this site. It does most of what you would expect from a blogging app, but there are a few features that it does differently. The main difference is extended markup, but there are a couple of other features that worthy of note: Multi-blog capable. I want to blog on a variety of subjects, but because some of the things I post about (namely the geeky stuff) are only of interest to a select few, I risk turning away visitors who aren't interested in those techy posts. Categories and tags are one solution to this, but I prefer to have a number of blogs under an umbrella blog, each with its own posts, templates and tags. In Techblog, there is also a concept of a channel which appears exactly like a blog from the front-end, but aggregates posts & tags from one or more blogs. In this site, the home-page at / is actually a channel consisting of /blog/tech/ and /blog/personal.Microblogging. Techblog has support for Twitter and potentially other microblogging services could be added. You add your twitter account details, which Techblog … -
Werkzeug and reverse urls
Werkzeug and reverse urls -
Django Applications at Work
Today someone at my work just released a simple Django app, the second one now running at my company. Here are the two Django apps running so far: Server scanner This is the first Django application that we use. It started out as a script that would scan all the computers on our network and determine what version of our software they were running by inspecting a special file in one of the publicly available SMB shares. The script took about half an hour to run and generated static html that was then served up by Apache. This became cumbersome for a number of reasons. For one, it took about an hour to scan the entire network. There was no persistence whatsoever so my script had no memory of which servers had our software installed on it. These servers are quick to check. The ones that are slow to check are the ones that are actually no longer on the network, or do not have the publicly available share that we are expecting. When the project manager emailed me one day and said "the servers on this page are often out of date" I sprung in to action and converted …