lakshman
Comments
Reactions

Great Indian Developer Summit 2010: A Review

By : lakshman

GIDS_logo Great Indian Developer Summit, is the India's largest developer conference, held at Bangalore, India; in its third edition this year. The conference concluded last Friday. The summit had about a 1000 visitors on the first day and a comparable number on the other days. The conference basically caters to the enterprises, and hence their focus on the .Net, Java and Flash. There were many star speakers. I'm speaking I gave a talk on django, introducing it and then explaining the standard community conventions to make good reusable applications. Django, being a social software, developed by a community, it is important to ...

more info..
Topics : Uncategorized
shabda
Comments
Reactions

Rails and Django commands : comparison and conversion

By : Shabda Raaj

The most commonly used Rails commands and their Django equivalents

Rails | Django

rails console | manage.py shell
rails server | manage.py runserver
rake | None
rails generate | None
rails dbconsole | manage.py dbshell
rails app_name | django-admin.py startproject/manage.py startapp
rake db:create | manage.py syncdb

The salient points to note are,

  1. Django has all commands via manage.py, Rails has it broken into rails and rake.
  2. Overall there are more Rails+Rake commands available than Django commands
  3. There is no one to one mapping between Rails and Django commands. Eg. There are no equivalent to rake doc:* or rake ...

more info..
shabda
Comments
Reactions

The Rails and Django models layer Rosseta stone

By : Shabda Raaj

Rails Active records and Django models are more similar than they are different. This is a quick guide to converting between Rails 3 and Django 1.2, and is available on github at http://github.com/uswaretech/Acts-as-Django

Defining models

Both Django and Rails keep the canonical database representation in ruby or python.

#Django

class Post(models.Model):
    name = models.CharField(max_length = 100, )
    slug = models.CharField(max_length = 100, )
    body = models.TextField()

class Comments(models.Model):
    post = models.ForeignKey(Post)
    username = models.CharField(max_length = 100, )
    comment = models.TextField()

#Rails

#db/schema.rb
ActiveRecord::Schema.define(:version => 20100319195739) do

  create_table "comments", :force ...

more info..
shabda
Comments
Reactions

Doing things with Django forms

By : Shabda Raaj

Forms are one of the best features of Django. (After models, admin, url routing etc :) ). Here is a quick tutorial describing how to do things with Django forms.

  1. Basic form

Prob. You want to show a form, validate it and display it.

Ans. Create a simple form.

class UserForm(forms.Form):
    username = forms.CharField()
    joined_on = forms.DateField()

This wil take care that the form is displayed with two text field, and a value for them are filled in, and the second field has correct formatting for a date.

2.

Prob. Create a form which has values populated depending upon a ...

more info..
shabda
Comments
Reactions

Django-buzz

By : Shabda Raaj

We have updated the Django popular stories widget, which powers the widget in the side bar. It is now on Github.

Earlier the code used was hardcoded to only find Django stories, but now you can create arbitary topics from admin.

Get the code and create the widgets on your servers, (or let us know, and we will create it here if it is interesting). We created three we want to track. Databases, Python and Javascript

Databases

Python

Javascript


We build amazing web apps. Talk to us to discuss what we can do for you.

more info..
Topics : Uncategorized
lakshman
Comments
Reactions

Using bpython shell with django (and some Ipython features you should know)

By : lakshman

What is bpython?

bpython is a fancy interface to the Python interpreter for Unix-like operating system.

says the bpython home page. It provides syntax highlighting, auto completion, auto-indentation and such stuff.

Unlike iPython, which implements then entire shell functions and emulates the standard python shell, and adds enhancements, bpython just adds features on top of the existing python shell functionality, using the curses module.

bpython

The "killer feature" of bpython is, as you can see from the image above, the IDE like prompting of the function parameters and the doc string of the function dynamically. I have always thought, what IntellijIDEA ...

more info..
shabda
Comments
Reactions

The magic of metaclasses in Python

By : Shabda Raaj

Metaclasses are a way for you to have a class act as the template for another class. They are simlar to a classfactory, in that they create new classes. In words of Tim Peters Metaclasses are deeper magic than 99% of people are going to need.

However, in right hands they can be a potent tool, in particular Django uses metaclasses beautifully to create very beautiful declarative models. Without further ado, here is a very simple (and very wrong) metaclass example.

class Z(type):
    def __new__(cls, name, bases, attrs, ):
        print cls, name, bases, attrs

class A(object):
    __metaclass__ = Z ...

more info..
Topics : Uncategorized

Pycon India 2009 : A Review

By : lakshman

Pycon India concluded last weekend at Indian Institute of Science, Bangalore.

There have been so many python/django conferences recently, I have been tracking them literally all through the year. Another one, SciPy India just got announced. Week long, with sprints!

Pycon India was attended by around 350 people and had 30 talks. I have attended many conferences, but this one was different. This one was where real people, the real developers gave talks and socialized. No enterprise BS, just the real thing*.

There were a vast majority of good talks. However, I could only attend a few. Strand use ...

more info..
Topics : Uncategorized
lakshman
Comments
Reactions

Better Python package management using source and version control systems

By : lakshman

Thanks to awesome django community, there is plenty of open source django code around.

These packages get updated quite often and if you use it often like we do, you'd have possibly realized the need to manage these packages better.

Thankfully, all python ever needs is the source, and all you need to do is to place the source in the python path.

Most projects use Distributed Version Control Systems like Mercurial and Git, and they come locally with the entire history of the source which provides a lot of control to use any version of the code. For ...

more info..
lakshman
Comments
Reactions

Develop Twitter API application in django and deploy on Google App Engine

By : lakshman

Twitter's robust REST API enables building of good applications that leverage its increasingly large and real-time data.

Google's cloud system App Engine not only provides a scalable platform for deploying applications, but also proves to be economically viable because of its pay per resource usage model and a large free quota.

Little wonder then, there are increasingly large number of twitter apps being deployed on App Engine.

In this post, I am going to examine how to create a simple application based on twitter's REST API and deploy it on Google App Engine. A deployed version can ...

more info..

Popularising Django - Part 2

By : Shabda Raaj

If you would have read my Popularizing Django post, you might know that I consider building a killer packaged app to be the best way to popularize Django. This is a post about what that app must be.

For PHP it was Wordpress and PhpBB. Both were free, very easy to install and came with every thing packaged. If you have followed the history of either you must know that they have always been plagued by security problems. Assertion: Most users, even programmers, value ease of use and install over technical superiority. Case in point, Windows vs Linux.

For Rails ...

more info..
Topics : Uncategorized

Five things I love about Django.

By : Shabda Raaj

I posted five things I hate about Django, so as a penance, I will of course have to tell the "Five things I love about Django".

The Admin interface rocks:

I have demoed Django to a fair number of People, and when you write a few lines in models.py, and then show the auto generated Admin interface, this is a jaw-dropping moment. Happened with me every time I introduced Django to someone. In Barcamp Hyderabad 05, people could not believe this was so easy, and asked if there was some more code behind this.

Of course Admin is much ...

more info..
Topics : Uncategorized
© Agiliq, 2009-2012