Favorite Django Tips
Installing Python 2.5 in Fedora 12 for Google App Engine
Views in subfolder
If you want to put your views in a subfolder and you are getting an import error, all you have to do is create a blank “__init__.py” file within that subfolder and everything should work fine.
Tips for readable python code
In this post I will try to explain some tricks I use to make python code more readable. These tips won’t make your code shorter and it won’t be better optimized, it will actually use more memory than before, but it will be much easier to understand and edit for someone else.
Read the rest of this entry »
Override adding plural “s” in django admin
If you have non-english names for your models, they will look bad when django admin tries to make plural out of them by adding “s” in the end. Fortunately it is easy to override by defining “verbose_name_plural” in your model. Here is an example:
1 2 3 4 5 6 | class Tag(models.Model): class Meta: verbose_name_plural = "Tagovi" ime = models.CharField(max_length="300") opis = models.TextField(blank = True) |
django.core.exceptions.ImproperlyConfigured: Error loading psycopg module: No module named psycopg
Well, it seems that you are simply missing Psycopg – PostgreSQL database adapter for Python, you need it to connect to PostgreSQL database.
To install untar file that you downloaded, go inside psycopg2-x.x.x folder and execute
> python setup.py install
Reasons why to use Django
First of all, what is Django? Django is high-level Python Web framework that was released under BSD license in 2005. It emphasizes re-usability, rapid development and DRY (don’t repeat yourself) principle.
There are a lot of great web development frameworks avaliable, like Ruby on rails and Codeigniter for PHP that follow same principles so we could say that Django is just another fast development web framework but with different flavor. And this is why I like this flavor best.
Read the rest of this entry »








