Articles in blog tagged with django
Tuesday, 22 December 2009
Debugging utf-8 Email In Django And Python
In case anyone else is wondering why their utf-8 email is not coming out as it should when using Django...
Non-ascii character sets are a major pain when writing code to send email. They're not impossible by a long way but they do take some digging to figure out why your nicely formated utf-8 Chinese is coming out in garbled characters, tracing code, examing email headers... Oh the joy. So it does not help when your framework of choice (Django) decides it knows that you really want a certain type of text encoding, even if you are writing your own…
Thursday, 19 November 2009
Creating Users: an illustration of the differences between PostgreSQL and MySQL
Like many starting out in websites and databases my first experience was with MySQL. I had no choice since the hosting service I used only offered MySQL. This is still the case for a lot of hosting - you get the standard LAMP stack and nothing more. I had read on the web that everyone is using MySQL, so how bad could it be? I was forgetting the maxim that quality and popularity are inversely proportional. BTW: it's not really popularity in this case - it's the most users - think Windoze.
Anyhoo, I struggled through the nightmare that is…
Wednesday, 8 July 2009
Django Related And Inherited Name Attribute Clash
Bare with me it's a long story...
When deleting an object I was getting this error from Django:
'RelatedManager' object has no attribute '_collect_sub_objects'
The reason was an attribute name clash on a base class. Finding the reason took some time so here's the low down in case any one else runs in to this.
In one app I had a model Company:
class Company(models.Model):
name = models.CharField(max_length=1024)
and in another app I had a model AdClient:
class AdClient(models.Model):
company = models.ForeignKey(Company, related_name='client')
Then some time later I wrote a new app inheriting from Company as:
class Client(Company): name =…Tags:
djangoWednesday, 24 June 2009
Guardian's MPs Expenses Crowdsourcing Lessons
The Guardian set up a Django site to crowdsource analysis of the released (and redacted) MPs expenses claims. The Nieman Journalism Lab has a good piece on the lessons learned.
Thursday, 18 June 2009
Moving From ExpressionEngine To yajogo
When I first set up this site back in 2005 I looked around for a blogging platform and chose ExpressionEngine. After years of bad experience with PHP (it's such a mess) I was relucant to use a platform based on PHP but EE is a good and well thought out system. (BTW EE is about to release version 2.) So there we were.
Always in the back of my mind was: "You know how to do this. Why don't you write your own system?" Well life and business got in the way and I never got around to it.…
Friday, 4 January 2008
Django AttributeError: ‘module’ object has no attribute
If you get the error “AttributeError: ‘module’ object has no attribute ‘xyz’” in Django. It probably means you’ve added a new app but forgot to put the __init__.py file in the app’s directory.
Tags:
djangoThursday, 11 May 2006
Django technical_500_response error
I recently switched from the Django magic-removal branch to the trunk post-magic-removal. I was getting this bizarre error:
Mod_python error: "PythonHandler django.core.handlers.modpython"
Traceback (most recent call last):
File "/sw/lib/python2.4/site-packages/mod_python/apache.py", line 299, in HandlerDispatch
result = object(req)
File "/Users/simonb/src/dj/trunk/django/core/handlers/modpython.py", line 157, in handler
return ModPythonHandler()(req)
File "/Users/simonb/src/dj/trunk/django/core/handlers/modpython.py", line 129, in __call__
response = self.get_response(req.uri, request)
File "/Users/simonb/src/dj/magic-removal/django/core/handlers/base.py", line 100, in get_response
File "/Users/simonb/src/dj/magic-removal/django/core/handlers/base.py", line 133, in get_technical_error_response
File "/Users/simonb/src/dj/trunk/django/views/debug.py", line 115, in technical_500_response
c = Context({
IndexError: list index out of range
Well, it took me a while to figure out. Notice that the directory name used for the Django distribution…
Tags:
djangoSunday, 7 May 2006
Django Talk Video
Tags:
djangoSunday, 8 January 2006
Django and Rails Creators Talk Video and Audio
Snakes and Rubies Chicago, 3 Dec. 2005: The creators of Django and Rails each gave talks and discussed web frameworks. Download the video and audio here
Tags:
djangoAbout
I'm the chief geek of yaean design based in Shanghai.
Tags
- 3D
- ajax
- art
- audio
- bbc
- books
- browsers
- business
- cars
- china
- chinglish
- christmas
- cms
- crowdsourcing
- design
- django
- education
- food
- football
- games
- generators
- gentoo
- guitars
- health
- history
- hongkong
- html5
- humans
- humour
- inspiration
- internet
- iphone
- javascript
- kids
- lego
- life
- linux
- mac
- magazines
- maps
- maths
- media
- mobile
- movies
- music
- mysql
- nasa
- nature
- news
- p4p
- parenthood
- photography
- physics
- poetry
- postgresql
- privacy
- programming
- python
- radio
- research
- restaurants
- robots
- ruby
- security
- shanghai
- solar
- space
- standards
- stories
- superpowers
- tagclouds
- taste
- tech
- travel
- type
- ui
- uk
- ux
- video
- visualisation
- web
- windows
- word
- writing
- yajogo