Archive

Archive for the ‘django’ Category

django tricks part 2

February 2nd, 2007 No comments

Or how to serve your media folder within the development web server?

pretty easy, if you know how :-)

add this to your main url.py:

from django.conf import settings
if settings.DEBUG:
  urlpatterns += patterns('',
    (r'^media/(?P.*)$', 'django.views.static.serve',
      {'document_root' : settings.MEDIA_ROOT,
      'show_indexes'  : True}),
  )

be sure to specify MEDIA_ROOT in your settings.py.
also, be sure to set ADMIN_MEDIA_PREFIX = '/media/admin/'

Categories: coding, django Tags:

django newforms tricks

February 2nd, 2007 7 comments

Image you have some sort of user-profile, and you want to automatically render it using newforms. But leave certain fields out.
(i.e. the user may not be able to change the associated user)

Read more...

Categories: coding, django Tags:

web development framework

January 25th, 2007 No comments

django
combines python, Database Model, and complete Template Functions to a great system!

djangoproject.com

* Person 1: "What do you do for a living?"
* Person 2: "I work with computers."
* Person 1: "So do I! What do you do with computers?"
* Person 2: "I'm a Web developer."
* Person 1: "So am I! Design, client-side programming or server-side programming?"
* Person 2: "Server-side programming."
* Person 1: "Same here! Do you use dynamically typed languages or statically typed languages?"
* Person 2: "Dynamically typed languages."
* Person 1: "So do I! Do you use a Web framework, or do you roll things on your own?"
* Person 2: "I use a Web framework."
* Person 1: "So do I! Django or Rails?"
* Person 2: "Django."
* Person 1: "Die, heretic scum!"

from http://www.djangoproject.com/weblog/2006/dec/06/comparisons/

Categories: coding, django Tags: