Posted On 02 December 2013 By MicroPyramid
More Often you wouldve come across sharing screens with applications like Teamviewer, Windows Remote Desktop Connection or remmina (if you're a linux user). But if you want to share only your terminal, you can look upto Tmux.
Posted On 17 November 2013 By MicroPyramid
A decorator is a function that takes another function and returns a newer,prettier version of that function.
To know more about decorators in python see here https://micropyramid.com/blog/programming-with-python-decorators/
The most common use of a decorator is the login_required. This decorator is used in conjunction
with a view that restricts access to authenticated users only.
Posted On 05 November 2013 By MicroPyramid
Haystack works as search plugin for django. You can use different back ends Elastic-search, Whose, Sorl, Xapian to search objects. All backends work with same code. In this post i am using elasticsearch as backend.
pip install django-haystack
Posted On 04 October 2013 By MicroPyramid
Quick guide to host django application using uwsgi and nginx which offers better resource utilization and performance.
Posted On 27 September 2013 By MicroPyramid
Now we are going to index text content which is stored in structured files such as PDFs, Microsoft Office documents, images, etc using haystack and sorl's
In order to read and store the data, we can use SearchBackend.extract_file_contents(self, file_obj) method. It takes the file object, returns a dictionary containing two keys: metadata and contents. The contents value will be a string containing all of the text which the backend managed to extract from the file contents.
Posted On 28 August 2013 By MicroPyramid
There are many ways for generating PDF in python. In this post I will be presenting PDF files generation with xhtml2pdf.
xhtml2pdf: xhtml2pdf is a HTML/CSS to PDF converter written in Python and therefore platform independent. xhtml2pdf supports for frameworks like Django and simple integration into Python programs. It is also usable as stand alone command line tool.
pisa: pisa is a html2pdf converter using the ReportLab Toolkit, the HTML5lib and pyPdf.
Posted On 14 August 2013 By MicroPyramid
Serializers are used for “translating” Django models into other formats like xmi,json,yaml(YAML Ain’t a Markup Language)
from django.core import serializers
data = serializers.serialize("xml", SomeModel.objects.all())
Posted On 27 July 2013 By MicroPyramid
Django has MVT architecture. A view in django is just a callable that takes a request and returns a response. But this can be more than just a function, that contains the actual business logic of an URL. In addition to normal funcation based views Django provides of some classes which can be used as views. These allow you to structure your views and reuse code by inheriting them.
Posted On 06 July 2013 By MicroPyramid
In most of the cases, you need to export the data from your database to different formats. In this post I will show you how to create functions in your Django applications which export data as files. Here I will be covering the mostly used formats: CSV and Excel.