Django community: Community blog posts RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Mails amb Django - II
Enviar un e-mail fent servir plantilles Django Com ja tots sabeu Django té un sistema de plantilles molt eficaç. Normalment les fem servir per mostrar l'html de les nostres aplicacions web, però no estan limitades a això, i com veurem les podem fer servir per generar els nostre correu. La manera de fer-ho és fent servir render_to_string que podem trobar a django.template.loader. Aquesta funció agafa com a paràmetres el nom de la plantilla que volem fer servir i un diccionari amb els paràmetres que farem servir a la plantilla. Agafa un tercer paràmetre, que ha de ser de tipus Context, però que per als nostres objectius no la farem servir gaire. Quan volem enviar un correu ho podem fer dins la vista, però sovint ho farem des de classes d'utilitat, el model o un formulari, on el request no està disponible. Per això hem de tenir em compte que la majoria de vegades no tindrem accés a les variables que normalment estan accessibles a les plantilles mitjançant el context processors. Així doncs que si el correu te links pensau que tot el que siguin referències a arxius i links forçosament necessiten de Sites, MEDIA_URL i STATIC_URL (o fer servir el … -
Django Webmaster Verification
Today I have released version 0.2.1 of django-webmaster-verification. I never took the time to write a post about it, so here you go. The Django application helps to quickly register with various webmaster tools like: Google Webmaster Tools Bing Webmaster Tools Yandex Webmaster Tools Majestic SEO Alexa These tools can help you to monitor your site's performance in search engines which can be quite useful. Django-webmaster-verification is a very simple app that I wrote to avoid repeating setting up the Google tools on each site I manage. It grew a little from there, and today I added support for the Alexa tools. I'm not a big fan of Alexa and I don't think their metrics are very useful. All the people I know who use it are into something like internet marketing, SEO, etc. Nothing against that, but it makes me think that the Alexa data does not represent an average sample of the web population. Anyway, somebody requested it, more power to him! So if you're a Django developer and at least a little interested in SEO give it a try. -
Django Webmaster Verification
Today I have released version 0.2.1 of django-webmaster-verification. I never took the time to write a post about it, so here you go. The Django application helps to quickly register with various webmaster tools like: Google Webmaster Tools Bing Webmaster Tools Yandex Webmaster Tools Majestic SEO Alexa These tools can help you to monitor your site's performance in search engines which can be quite useful. Django-webmaster-verification is a very simple app that I wrote to avoid repeating setting up the Google tools on each site I manage. It grew a little from there, and today I added support for the Alexa tools. I'm not a big fan of Alexa and I don't think their metrics are very useful. All the people I know who use it are into something like internet marketing, SEO, etc. Nothing against that, but it makes me think that the Alexa data does not represent an average sample of the web population. Anyway, somebody requested it, more power to him! So if you're a Django developer and at least a little interested in SEO give it a try. -
Mails amb Django - I
En aquest article, o millor dit, sèrie d'articles, intentaré explicar el millor que pugui la problemàtica que ens trobam en el dia a dia la gent que hem d'enviar correus electrònics des de les nostres aplicacions Django, no tant des del punt de vista de com es fa, sinó del programador que té que desenvolupar d'aplicació. Veurem distints escenaris i com podem tenir una solució que s'adapta a cada un d'ells, de manera que acabem amb un petit receptari, que esper anar ampliant amb l'adjuda de tots. La referència fonamental per Django és la documentació "sending email", miraré de no repetir-la molt, però per completitud convé fer una petita introducció. Configurar el servidor Volem enviar un e-mail ràpid en resposta a un esdeveniment. Per a poder enviar un e-mail des de la nostra aplicació Django prèviament haurem d'haver configurat en nostre servidor SMTP. Això es fa amb les variables del settings EMAIL_HOST, EMAIL_PORT, EMAIL_HOST_USER i EMAIL_HOST_PASSWORD. Ja que hi som convé definir el mail que farem servir en cas que no el posem de manera explícita al DEFAULT_FROM_EMAIL Normalment no hem de definir res si el nostre servidor d'e-mail és el mateix servidor on està l'aplicació i tenim un SMPT … -
Django AJAX Edit Mode
I can't even remember where I saw this, but the suggestion was that viewing and editing data are different operations, and should be different modes. For instance, when viewing some data, you would need to explicitly decide to enter the edit mode. In a web page, this would be by following a link to a page that had a form that allowed for editing. Attempting to submit the form would result in either the same page being displayed, along with any validation errors, or being redirected back to the viewing page. This is the pattern I've been working on implementing with a module for our work system. However, we can reduce the amount of data sent, and the amount of page redraw, by using dynamic element replacement. So, we can have some AJAX that loads in the edit form in-place, and replaces the view form. Saving it then either returns the edit form with validation errors, or the view form again. We can do all of this with one view. Depending upon how it is accessed, it will return either a different template, or render the template differently. ## Solution One: render a different template. {% highlight python %} # … -
My First Kickstarter
In days gone by, getting money from a group of random people over the internet was probably a crime. Now it's the next step in project funding. UPDATE: The kickstarter has gone very, very well. I'll be writing a long post as it draws to a close about the whole experience. I've had the idea of crowdfunding an open source project for a while now, but it wasn't until a few weeks ago that it occurred to me that I could combine my one free day a week (which I used to use for flying lessons) and my pet Django feature into one crowdfundable whole. Thus, today I'm launching the Schema Migrations for Django project on Kickstarter. I've set a goal which would pay for a decent amount of my free days, and I'm hopeful that it will be reached. I'll do a post-mortem blog post on the project and what running a Kickstarter project of this type is like once it's over in two weeks' time - I can say, however, that I've had invaluable feedback from friends and members of the Django community to help me polish the descriptions, tweak the rewards, and generally get it feeling like … -
Logging in Django
This is a talk I gave at Agiliq on 21-March-2013 as a part of the Hyderabad Python Meetup Group -
Django Meetup – March 21, 2013
Today I had the pleasure of talking about how my team switched from PHP to Python (Django) and the realizations that I had after the process. I learnt a lot about web development in the process and had a great time making the site better for our users. Related posts: Welcome to ProcrastinatingDev DjangoCon 2011 – Real world Django deployment using Chef DjangoCon 2011 – Confessions of Joe Developer -
Serving static files in Django
Serving static files, especially during development, is frequently a pain point. In this post, we will discuss the various settings and directory structure and how they interact with each other. Let's start with development when you have DEBUG = True. We will create a Django project from scratch so that we are fully aware about what file in what directory we are talking about. So, this blog post will be a little longer than it should be. We will try these things with Django 1.4, but these will work on Django 1.3 as well. I have not tested it with Django 1.2, so not sure about 1.2. Setting up the project. If you think you don't need this section, then skip to the next section titled Serving static files. Just make sure to see the directory structure at the end of this section to get an idea of it, so that you will be comfortable in the next section. We will try everything inside a virtual environment. We name our virtual environment as staticvirt. So the command we need is virtualenv staticvirt. ~$ virtualenv staticvirt Next we need to start a Django project inside this virtualenv. Make sure you are … -
Farewell, Malcolm
Following an amazing week at PyCon, I woke up this morning to discover that I'd lost a good friend, and that the Python community has lost one of its most brilliant minds. Details are still unclear, but Malcolm Tredinnick passed away this past weekend, apparently as the result of a seizure. I met Malcolm first online - I was very new to Django, and had just written a blog post about a kludgy method I'd worked out for using a model manager to switch between multiple databases. This was well before multi db became a regular part of the ORM, although at the time it was already a much-requested feature. My method worked, but it was not elegant or pretty, and when I saw Malcolm's name among the comments on my blog post, I was immediately intimidated. But he gave me some tips and taught me a few things through his questions and comments. And when I met him at DjangoCon the following year, he was nothing but kind, encouraging me to continue learning and writing. For a brief time, I lived in Lawrence, Kansas, and I was fortunate enough to get to spend some time with Malcolm whenever he … -
Introduction to Django – presentation
This presentation shows the basics of Django – what is inside the framework and explains the Model-View-Template system. One of the most important parts is a diagram how the request is processed and the response is generated. Shows the project and the application structure and the basic elements – Models, URLs dispatcher, Views and Templates. Introduction to django from Ilian Iliev -
Functions in Python Homework
After some delay(please excuse me for it) here are sample solutions of the problems defined in the presentation Functions in Python. Solutions are also available at GitHub. -
#djangosthlm - talking Django hosting
I’m sitting on yet another train from Stockholm back the good old industrial Västerås (or Bästerås as we call it (or Webbsterås;-)), me and my colleague Richard just attended the Django Stockholm meetup, hosted by Dynabyte. Awesome evening with awesome people, moar please=) The first talk of the meetup was Henrik talking AND live coding while using South, really impressive that he almost completely pulled it off! Big kudos to Henrik=) I myself did a small talk about all the different alternatives that exists for hosting a Django site in the year 2013. With a small intro to shared hosting we quickly moved on to DotCloud, Heroku, Gondor etc. We talked a bit about best practices and this best practices bit would maybe fit for a one day hackathon or something. To be able actually nail this. My slides are not much to see since I mainly use them to show of my mad graphical skillz (I mean, WHO doesn’t want a magical pony and rainbows in their presentation). If you want, go ahead and take a look, the interesting part starts at the end, with all the links to better blogposts about hosting than this ;-) Thanks again to … -
Raspberry IO announced at PyCon
PyCon is one of our favorite conferences here at Caktus. We’ve been attending for the past 4 years now and it is amazing to see how much the community has grown. This year is especially special because Jesse Noller and the Python Software Foundation (PSF) came to us to help them build Raspberry IO. The site features work from the Python community and their adventures in using Raspberry Pi with Python. One of our passions at Caktus is collaboration and education. The Raspberry IO application exemplifies just that. Developers share the steps of how they’ve created their projects and interact with other users by providing feedback and answering questions. The site features a Q&A, a wiki and also a community feed aggregator. Users who are extremely active on the site, contributing projects, answering questions will have their projects featured on the homepage. We worked closely with the PSF to also create the logo and branding of the site. Our designer, Julia Elman, drew inspiration from the vintage video game era to create Razzy, the mascot for Raspberry IO. This is Jesse Noller’s last year as the chair of PyCon and we are sad to see him go. This application was his going … -
Django Internationalization
A few weeks ago I gave a talk at the Chicago Djangonauts meeting on Django Internationalization. Apparently this isn't a task that a lot of people need to do frequently, as the crowd was not too familiar with the content of the talk. Luckily, internationalization isn't too complicated ... -
Google Appengine - First Impressions
Google launched their EC2 competitor, Appengine yesterday, and all hell broke loose. And in about 24 hours, the 10,000 accounts were used up. Currently it is tied to only working with python, and Django 0.96.1 works out of the box. <!- - more - -> The Good Python powered. Django works out of the box. No sysadmining chores. Promise of infinite scalability with no configuration. (Ah!) Free for now. The Bad Python powered, if you want to use ruby/java/php, sorry you are out of luck. Your code is tied to Google. You might be able to reuse most of your code, but the DB/ORM sepcific code, ah you are out of luck. And if you are building database backed websites, well most of your most complex code talk to ORM. Too magical. Explicit is better than implicit. On the dev server I do not know where my data is stored. If I change the data model, the changed models are available immediately. But well, how do you do it? Free for now, and no way to pay for when your usage out grows the free quota limits. -
Using Appengine with Django, why it is pretty much unusable
We are hard at work building 42topics.com, and are looking at the best places to deploy this. So when I heard about Appengine, with out of box Django support(gasp!) I was delighted. After using it for a day, and posting a tutorial, I am so disappointed. Peeves in no particular order. Appengine is a very constrained environment, so out goes any chance to run background jobs. The ORM-API is very similar to Django, but yet the Django API is much better. modelobj.filter('attr =', value1).filter('attr2 =', value2) or modelobj.filter(attr = value1, attr2 = value2). Putting entity level operations on modelobj.manager is much cleaner that making them classmethods, as argued here. Very half baked documentation. Releasing without sufficient testing on windows. If you follow the Getting started guide, and are on windows, I hope you like debugging regexes NO JOINS? Ok so I can use obj.master to simlute this. Umm can I get GROUP BY? What about UNION? Admittedly Bigtable is not relational, but are you telling me Google built all their search without a way to simulate GROUP BY. PDB does not work on dev server. With Django's dev server, I put breakpoints with PDB all the time, and it works … -
Two Django+Appengine Tutorials
I have posted two Tutorials for Using Django with Appengine. For people who do not know Django For people who already know Django see what we build in this tutorial And here a few good links about the topic. James Bennet tells exactly why Appengine and Django are not so good together. Ian Bicking has an interesting take on how Appengine can change the economics of Python hosting. The guys at Joyent reading my mind on why I or you can not deploy any production site on Appengine. (Hint. you mean I can never move away, without writing half my code?) -
New tutorial - Building a search engine with Appengine and Yahoo
I wrote a new tutorial on building a search engine using Appengine, and Yahoo Search API here. This uses pure Appengine API, and not Django, and is a tutorial on how to use Appengine without Django. -
Five Things I Hate About Django.
The five things I hate about * meme seems have died down, and memes, should not be allowed to die. Of course I love Django, and have bet very heavily on it. But we do not know a topic, until we know it warts, so here you go. The listing is in no particular order, so sorry no numbering. Ajax with Django is hard: Most of the Django Community has decided that bundling Javascript helpers with a python framework is bad idea. Though I can understand the reasoning, (argued here and rebuttal), that Javascript is so basic that you can not be expected to not know it, I can not agree with it. SQL is as basic as Javascript, and yet we have ORM for abstracting away the common and the tedious. Of Course, with simplejson, and a good Javascript library, you can build Ajax apps fast and with only a minimal amout of fuss. And yet switching between Python and Javascript, twice every hour is a huge time drain. Eg. I put commas after the last element in Python arrays, with JS this would work in FF, but fail with weird errors in IE. Lack of identity map: If … -
An interview with Malcolm Tredinnick - Django core contributor
Malcolm Tredinnick is a core contributor to Django, and was the driving force behind the Queryset-refactor branch of Django, which adds important capabilities such as model inheritance. He has a long association with OSS, and contributed significantly to GNOME and Django. He graciously agreed to be interviewed at 42topics blog. Malcolm's blog, Defying Classification, can be read here. Shabda: Would you tell a few things about yourself, how did you get involved with OSS and Gnome, and with Django? Malcolm: Here are some recollections I've written about: 1 and 2 Short version; started using Linux in university as a poor undergrad; kept using it since then (started back in 1993). Started using GNOME in 1999 (after trying a very early version of Qt and what became KDE), started contributing to GNOME about 12 months later (mid-2000). Started using Django in October 2005, I guess (a few months after it was open sourced) and haven't stopped. Started contributing patches more or less immediately and was given commit privileges about March of 2006, from memory. Shabda: So what is one thing in Django which you absolutely love, and one thing which you think Django should have done differently? Malcolm: I guess Django's … -
Interview with James Bennett - Django release manager
James Bennett is the release manager of Django, and a long time contributor. He works on Ellington, a CMS designed for news organizations. His book, Practical Django Projects, is being published by Apress, and is scheduled to hit bookshelves in June 2008. He graciously agreed to be interviewed at the 42topics.com blog. His blog, The B-List, can be found here. Shabda: Would you tell something about yourself, how did you get started with Django, and what other OSS projects are you involved with? James: I got into Django fairly soon after the initial public release; I'd been doing PHP and Perl work (mostly Textpattern on the PHP side, Scoop on the Perl side), and I was working on teaching myself Ruby and Rails because it looked interesting. But I'd always liked Python; it was just that there weren't a whole lot of good options for Python web development at that point. You could do Zope, or you could do Twisted, but they both had pretty steep learning curves when compared to the type of work I was doing, so it just wasn't worth it. Django changed that; I think I did the tutorial the day it was released, and I … -
An interview with Russell Keith-Magee - Django core contributor
Russell Keith-Magee is a longtime core contributor to Django. He has worked extensively with the Django testing and serialization components. He is currently working on django-evolution, the ability to do schema evolution from Django, an often requested feature, and is mentoring a GSOC proposal to add aggregate queries support to Django ORM. He is currently a Senior R&D Software Engineer at plugger.com.au. He graciously agreed to an email interview with the 42topics blog. Shabda: Would you tell a little about yourself? How did you get started with Django? What areas of Django have you contributed to? Russell: I'm a thirty-one year old, father of one, living in the most isolated capital city in the world - Perth, Western Australia. Strangely, for all my involvement in Django, my background has almost nothing to do with the web. I studied Physics as an undergraduate, and studied neural networks for my PhD. My first job was with a startup in the defence industry developing simulation frameworks. Over time, mostly as a result of my association with Django, I've become more involved in building web services. Shabda: How did you get started with Django? What areas of Django have you contributed to? Russell: I've … -
Popularizing Django -- Or Reusable apps considered harmful.
For all its technical merits, Django is still a very niche technology. It is my belief that the thing which is holding Django back the most, is due to one of its strengths. Making reusable apps is easy and simple in Django. In Django this is the correct way to do things. You take a few apps, mix them together in your project, and deploy to start your site. Compare the installation steps of Wordpress and an imaginary blog software better than Wordpress called Djangopress. Wordpress FTP wordpress to webserver. Point browser to site.com/blog Next-Next-Next done. Djangopress Svn checkout Djangopress Svn checkout django-registration Svn checkout other Django apps Djangopress depends on. Maybe django-mptt, django-threadedcomments or a few others. Edit your settings.py to add all these apps to INSTALLED_APPS. Add database settings, and other changes if needed. Telnet to your server and do syncdb Create templates. Done. This does not take into account the extra hoops Apache makes you jump through, compared to using a PHP app. How I got started with web programming. I wanted to run a forum. PhpBB was free, and seemed most widely used. Installed it, and wanted to tinker with it, so learnt Php. If there … -
An interview with Michael Trier
Michael Trier is a long time Django user and evangelist. He has worked with a number of technologies including Rails and .net. His insights on marketing Django to traditionally Enterprisy areas were extremely informative. He produces TWiD, along with Brian Rosner which is great to keep abreast of the latest happenings in the Django community. He graciously agreed to be interviewed by the 42topics blog. Shabda: Would you tell a little about yourself, how did you get started with Django, what other projects have you used or are associated with? Michael: Well, I've been programming ever since I can remember, probably around 11 years old. I grew up in Silicon Valley, and that whole story is a pretty interesting one. I did the usual thing of starting out with languages like ASM, C, C++ , Pascal. Moved on to things like Delphi, VB, and most recently I spent quite a bit of time with Ruby, Rails, and within the past year and a half dabbling with Django. I came to Django for a particular reason. I was focussed on building a high content push type of site and it just seemed like Django was a much better fit for that …