A blog about Django, Python, mongo DB, LINUX, Amazon Web Services


Python Web Scraping with Beautiful soup

Posted On 05 November 2012 By MicroPyramid

Download all One Piece animation series episodes by scraping site using BeautifulSoup python library.


Posted On 21 October 2012 By MicroPyramid

The group() command, Aggregation Framework and MapReduce are collectively aggregation features of MongoDB. group(): Group Performs simple aggregation operations on a collection documents. Group is similar to GROUP_BY in mysql. Output format : Returns result set inline. Sharding: Its not support in shared environment. Limitations:

Django Generic many to many field implementation

Posted On 16 October 2012 By MicroPyramid

Django application has a GM2MField that combines the features of the standard Django "ManyToManyField" and "GenericForeignKey".

pip install django-gm2m

Daemonizing any command with SUPERVISOR

Posted On 12 September 2012 By MicroPyramid

Daemonizing a command means to make it run as a background process.

so when we have a command that we want to daemonize there are many ways to do it, most common methods are:

1. using upstart
2. adding it to /etc/rc.local
3. creating a script in /etc/init.d and adding them to runlevel folders manually (i.e. incase you want to start, stop a command)

Django Subdomains to do advanced things

Posted On 05 September 2012 By MicroPyramid

We always struggle to give users customization's even before they login to the system like abc.micropyramid.com and django don't know how to handle that out of the box.

We can do it by writing simple middle ware. Django Middle ware have access to request and responses, so, we can get hold on to request and pass it on to django views for further process. Here we will add new property to request and can render pages by seeing at the subdomain property.

Using Django's built in signals and writing custom signals.

Posted On 13 August 2012 By MicroPyramid

Django has a beautiful feature of signals which will record all the actions performed on particular model. In the current blog post we’ll learn how to use django’s built in signals and how to create custom signal.

Django has lot of built in signals like pre_save, post_save, pre_delete and post_delete and etc. Now we’ll learn how to use django’s pre_delete signal with a simple example. In the way we use pre_delete in the present blog post we can use other signals also in the same way.

Publishing Python Modules with PIP via PyPi

Posted On 02 August 2012 By MicroPyramid

We'll install so many packages in our day to day python development. Now in this blog post, we'll try to know how to create our own python module installable with PIP. PyPI is the default Package Index for the Python community. In this post will explain about how to develop and publish python packages to make those available to every one with develop pip install python packages.

Django Custom Management Commands

Posted On 21 July 2012 By MicroPyramid

In Django project, We could manage by executing some commands which could be invoked through the manage.py.

For example:
# Sync database
python manage.py syncdb

# Start the webserver
python manage.py runserver

Understanding 'GenericForeignKey' in Django

Posted On 06 July 2012 By MicroPyramid

In some cases the we might want to store generic model object, rather a particular specific model as 'ForeignKey'. Generic model object means adding a foreign key from one of your own models to ContentType allows your model to effectively tie itself to another model class

Basics of Django messages framework

Posted On 25 June 2012 By MicroPyramid

In any web application we need to display notification messages to the end user after processing a form or some other types of his requests. To make this messaging system simple, django provided full support to cookie and session based messaging for both anonymous and authenticated users.

This messages framework is capable of storing messages in one request and retrieving those messages in the subsequent request. Every message has a tag based on its priority(info,warning and error).

Need any Help in your Project?Let's Talk