Migrating django app from MySQL to Postgres

By : Manjunath Hugar

In this tutorial, we will take a django app backed by MySQL and will convert MySQL database to postgres database. This is useful if we are deploying our app to Heroku because Heroku uses standard Postgres

Prerequisites:

  • We assume that you have a running django app with MySQL as a database.
  • Also, your app is running on virtualenv.

Converting MySQL to Postgres:

Let's assume that you have a django app running with MySQL and you want to convert this to Postgres.

1) Install dependenicies:

$ pip install psycopg2
$ pip install py-mysql2pgsql

2) Create Postgres database:

postgres@agiliq-Inspiron-N5010 ...

more info..

Google diff match patch library

By : Manjunath Hugar

Diff match patch library is useful to compare the differences between the two texts.It compares the texts and displays what is added, removed or unchanged.

We use Python in our example below.

Let us see a quick example

Firstly, we will install diff match patch

pip install diff-match-patch

Moving forward we will import diff_match_patch

import diff_match_patch

Let us consider using two strings, we will name it as old_string and new_string

import diff_match_patch

old_string = """I'm selfish, impatient and a little insecure. I make mistakes,
I am out of control and at times hard to handle. But if you can ...

more info..

Supervisor with Django and Gunicorn

By : Akshar Raaj

Supervisor with Django: A starter guide

This post assumes that you have used gunicorn and know what it does. I will try everything inside a virtual environment and hope you do the same.

What is supervisor.

Supervisor is a monitoring tool that can monitor your processes. It can restart the process if the process dies or gets killed for some reason.

Use of supervisor: Why I started using it.

In production, I use gunicorn as web server. I started a gunicorn process as a daemon and logged out from the server. My site ran as expected for few days. All ...

more info..
Topics : django supervisor

Python-requests

By : Rakesh Vidya Chandra

When we want to fetch internet resources we tend to use urllib2 but when dealing with "HTTP basic Auth" urllib2 is pretty unintuitive and painful.

We can use urllib2.urlopen() to open the URL which can be a string or a request object, but the factor of the matter is that implementing anything beyond that is a bit troublesome.

Wouldn't it be a delightment, if we can use the GET, POST, PUT, DELETE with a single function call with the URL and auth data as parameters?

So Python-requests brings this delightment to life by extending the HTTP capabilities.

Python-requests ...

more info..

Three underutilized python commands

By : Shabda Raaj

Today's post are three simple Python commands which should be known more widely, but are not.

Start a simple web server to serve files from current directory.

~$ python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...

This is neither secure, nor scalable, but handy if you are in a directory and want to quickly test something.

Testing emails

~$ python -m smtpd -n -c DebuggingServer

Starts a fake SMTP server on port 1025. Useful if you are testing emails on a system which doesn't allow pluggable emails backends.

Pretty print JSON

echo '{"2legs":"Better", "4Legs": "Good ...

more info..
Topics : python tips Python

Continuous integration with travis and coveralls.io for Django apps

By : Rakesh Vidya Chandra

Maintaining a solid rapport with the ongoing software development process always turns out to be a walk on air. Ensuring a software build integrity and quality in every single commit makes it much more exciting.

If the current software bulid is constantly available for testing, demo or release isn't it a developer's paradise on earth?

Giving a cold shoulder to "Integration hell" the 'Continuous integration' process stands out to deliver all the above assets.

What's Continuous integration?

Continuous integration is a development practice that requires a developer to integrate code into a shared repository in which isolated ...

more info..
© Agiliq, 2009-2012