Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.

Ohloh Analysis Summary

Updated 16 May 2008 21:43 UTC


Ratings & Reviews

Community Rating
4.8/5.0

Based on 86 user ratings.

Your Rating

Click to rate this project.

8 months ago Avatar
Excellent tool for developers on all levels.

  by mikl

I have only recently started using Django, but so far I'm very excited.

Django is a project that's been used out there in the real world by professionals with budgets and deadlines to keep, and it shows. It is very well thought out and carefully engineered.

Django is a very Pythonic framework in that it favours clean and readable code over syntactic sugar - as the official site states: "Django is a high-level Python Web ... [More] framework that encourages rapid development and clean, pragmatic design."

I find that those words are true. Django is a good tool for me. It allows me to get my work done quickly in a straight-forward fashion. The default configuration and options are very sane.

The database layer (ORM) is very easy to learn. It is not as powerful as SQLAlchemy, but it is much easier to use and much better tested.

The URLconf system is a brilliant way of dispatching requests. The syntax is very easy. If you know regular expressions, you should have no problems.

The view mechanism do not require much effort either. The greater part of the codes goes to your application specific mangling of the data, not the plumbing.

The template system is a bit crude on first sight. It is nowhere near as powerful as many of its competitors (Kid, Genshi, etc.), but it performs extremely well, and it encourages you to move as much logic away from the templates as possible.

In general, it is very clear that this framework has been used and developed by some very clever people, and I can highly recommend it. [Less]

7 of 7 users found the following review helpful. Was this review helpful to you? |

Links

2 links submitted so far. Submit your own links.

News

Edit RSS feeds.

    Ivan Sagalaev: Тема на Exception #08

    Exception успел поменять номер с прошлого поста :-). А я таки определился с темой: по совету Макса Ищенко буду интегрировать Django с каким-нибудь ... [More] WSGI-проектом. Причем, видимо, на Pylons.

    Мы с ним также наметили подробнее, что именно входит в понятие “интеграция”.

    включение Джанго-приложение в URL-пространство чужого проекта с корректной генерацией ссылок
    ввязывание шаблона приложения на Джанго в общепроектные шапки/футеры
    использование [...] [Less]

    Cecil Meeks: Django Book for sale

    I am sad to say that I need to sell my "Django Book". The same book at http://www.djangobook.com.

    I love the book but I need to make room and clear out my book shelf. I am actually selling many of my "keepers" including some Rails ... [More] books.

    Send me a message if anyone is interested. Most of my books are in mint or near mint condition.

    Oh, and make me an offer. [Less]

    Marc Garcia: StdImageField: Improved image field for Django

    I'm pleased to announce a new project, django-stdimage, that provides a new image field with many improvements respect to Django's core ImageField.

    Features of StdImageField:

    Saved files have standardized names (using field name ... [More] and object id)
    Images can be removed
    Automatically creates a thumbnail
    Automatically resizes both image and thumbnail (with optional crop to fit ... [Less]

    Eric Florenzano: Exploring Mixins with Django Model Inheritance

    Django now supports Model Inheritance, and one of the coolest new opportunities that model inheritance brings is the possibility of the creation of mixins, so in this post I'll walk through the steps I went through to create some simple examples. ... [More] This is just an excercise (although it could be modified to be more robust)--and right now there are better ways to achieve all of the effects of the following mixins. (See django-mptt, for example).

    Model and Field Setup
    First let's just set up two basic models. The first will be our mixin, NaiveHierarchy, which has a single field, parent, which is a reference to itself. Using this, we can traverse the tree and find all sorts of fun hierarchical information. Also, we'll create the canonical example model: the blog post. Our models start out looking something like this:

    from django.db import models

    class NaiveHierarchy(models.Model):
    parent = models.ForeignKey('self', null=True)

    class Meta:
    abstract = True

    class BlogPost(NaiveHierarchy, DateAddedMixin):
    title = models.CharField(max_length = 128)
    body = models.TextField()

    def __unicode__(self):
    return self.title

    Now let's test to make sure that worked. We'll create some data and test that parent exists on the instances.

    >>> from mixins.models import BlogPost
    >>> bp = BlogPost.objects.create(title="post1", body="First post!")
    >>> bp2 = BlogPost.objects.create(title="post2", body="Second post!", parent=bp)
    >>> bp3 = BlogPost.objects.create(title="post3", body="Third post!", parent=bp2)
    >>> bp.parent
    >>> bp2.parent
    <BlogPost: post1>

    Inherited Class-Level Methods
    So as you can see, everything is working correctly! But that really doesn't save us much time yet, as it's fairly easy to copy and paste fields onto new models, and we still have to write methods which take advantage of those new fields. In this case, I already know that I'm going to want to get the related children and descendants of my blogposts. So why not write those methods on the abstract model? Thanks to inheritance, those methods will apply to the new model as well.

    class NaiveHierarchy(models.Model):
    parent = models.ForeignKey('self', null=True)

    def get_children(self):
    return self._default_manager.filter(parent=self)

    def get_descendants(self):
    descs = set(self.get_children())
    for node in list(descs):
    descs.update(node.get_descendants())
    return descs

    class Meta:
    abstract = True

    Now, getting all the children or descendents of a particular node is easy:

    >>> bp.get_children()
    [<BlogPost: post2>]
    >>> bp.get_descendants()
    set([<BlogPost: post2>, <BlogPost: post3>])

    Now this NaiveHierarchy mixin is starting to become quite useful! But what happens if I want to get all of the BlogPosts that have no parents? It's really manager-level functionality. So let's write a manager which defines a get_roots function. Unfortunately, using abstract managers doesn't quite work yet (it works for non-abstract inheritance), but it probably will in future versions of Django. In fact, by applying the latest patch on either Django ticket 7252 or 7154, it will work today. Let's see how this would look:

    class NaiveHierarchyManager(models.Manager):
    def get_roots(self):
    return self.get_query_set().filter(parent__isnull=True)

    class NaiveHierarchy(models.Model):
    parent = models.ForeignKey('self', null=True)

    tree = NaiveHierarchyManager()

    def get_children(self):
    return self._default_manager.filter(parent=self)

    def get_descendants(self):
    descs = set(self.get_children())
    for node in list(descs):
    descs.update(node.get_descendants())
    return descs

    class Meta:
    abstract = True

    class BlogPost(NaiveHierarchy):
    title = models.CharField(max_length = 128)
    body = models.TextField()

    objects = models.Manager()

    def __unicode__(self):
    return self.title

    Note that we needed to explicitly define objects as the basic manager, because once a parent class specifies a manager, it gets set as the default manager on all inherited subclasses. This would play out exactly how you would expect:

    >>> BlogPost.tree.get_roots()
    [<BlogPost: post1>]
    >>> BlogPost.tree.all()
    [<BlogPost: post1>, <BlogPost: post2>, <BlogPost: post3>]

    Advanced Stuff
    So now I really wanted to push the limit, and write a mixin which would enhance one of the basic methods of all Model classes: save(). This would be a DateMixin which would contain date_added and date_modified, where date_modified was updated on each save. To my surprise, this Just Worked. Let's see the final result:

    import datetime
    from django.db import models

    class DateMixin(models.Model):
    date_added = models.DateTimeField(default=datetime.datetime.now)
    date_modified = models.DateTimeField()

    def save(self):
    self.date_modified = datetime.datetime.now()
    super(DateMixin, self).save()

    class NaiveHierarchyManager(models.Manager):
    def get_roots(self):
    return self.get_query_set().filter(parent__isnull=True)

    class NaiveHierarchy(models.Model):
    parent = models.ForeignKey('self', null=True)

    tree = NaiveHierarchyManager()

    def get_children(self):
    return self._default_manager.filter(parent=self)

    def get_descendants(self):
    descs = set(self.get_children())
    for node in list(descs):
    descs.update(node.get_descendants())
    return descs

    class Meta:
    abstract = True

    class Meta:
    abstract = True

    class BlogPost(NaiveHierarchy, DateMixin):
    title = models.CharField(max_length = 128)
    body = models.TextField()

    objects = models.Manager()

    def __unicode__(self):
    return self.title

    Conclusions
    Mixins can be powerful tools, but there are some hazards in using mixins, which all boil down to the same basic problem: unexpected consequences. In the case of the DateMixin, if any other class has defined a save() method, our custom save() method simply won't be called unless called explicitly. Perhaps this is a documentation problem, but perhaps it's a fault in the idea of a date mixin altogether.

    So all that being said, I'm not suggesting to go off and start using any of the mixins that I have provided here, but rather to illustrate how a mixin can be constructed with Django's new Model Inheritance. I do hope that a reusable app emerges with some great mixins that are useful for a large variety of tasks. Because mixins are powerful, and new shiny things that Django can do, and new shiny things are worth being explored! [Less]

    Mininglabs: Web frameworks: a free software oriented study

    The web2.0 era has put the web application frameworks at the center of the free software community attention. Various opinions (1,2) and performance (1,2) comparisons have been published by free software enthusiasts trying to rank the quality and ... [More] the potential of different web frameworks.
    In this post we use standard data mining and statistical [...] [Less]

Read all Django articles…

Homepage
Download
37 downloads
Licensed under
BSD-ish License
Tagged as
Project Tags django python framework mvc web | edit tags

Who uses Django?

Anon32 Anon32 Anon32 Anon32 Anon32 Anon32 Anon32 Anon32 Anon32 Anon32 Anon32 Anon32

Who contributes to Django?

Anon32 Anon32 Anon32 Anon32 Anon32 Anon32 Anon32 Anon32 Anon32 Anon32 Anon32 Anon32 Anon32 Anon32 Anon32 Anon32
I'm a contributor

Where in the world?



Related Projects by Tags

byteflow, django-dbsettings, Hanji, Satchmo, TurboGears



Project Cost

This calculator estimates how much it would cost to hire a team to write this project from scratch. More »
Include
Codebase 63,682
Effort (est.) 16 Person Years
Avg. Salary $ year
$ 857,309