Python , Django setup on Mac OS X

i tried to use upper version of python instead of using  the default version on mac. that’s why i install my required version  . but the problem i faced that is python doesn’t know where to look for my libraries which macports installed . it always look into the default version of python library . so the solution is identify the path for my self install . i did that and it works . but for the beginner i write a small tutorial which may be help for very beginner of mac, python and django .

My Environment :

version : Mac OS X (10.6.8 )

OS : snow leopard

default python : 2.6.5

how can you check your default version :

$ python
Requirement :

1. Django 1.5

2.  python 2.7.x

Tools that need to install :

1. macport or HomeBrew: a package manager for Mac OSX that allow you to install UNIX tools.

2. pip : Package install for Python

3. Virtualenv – virtual environment for Python

Installation Steps :

1. install python . i used brew to install .
2. add new Python scripts directory to your PATH
3. install pip .
4. install django
5. Test django
6. create a project
7 . test project

Let’s follow the steps :
open the terminal

1. install python :
$ brew install python --framework

it will take few minutes.Once that’s complete, you’ll have to add the new Python scripts directory to your PATH .

2. add new Python scripts directory to your PATH
export PATH="/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages:$PATH"

3. To install pip,simply run :
$ easy_install pip
if you want to create virtualenv or others python packages then you can easily install through pip . Like next we want to install Django .

4. Install Django:

to install Django simply run this command :
pip install django

5. now just check the which version of django has been installed. simply run this command :
python -c "import django;print(django.get_version())"
it will show you installed django version django .

6. Now let’s create a django project . to create a project simply create your own new directory and under that directory just run that : startproject project_name
a directory will be create by your given project_name say mysite . and it will be look like :

7. now you want to test . for that you need to run server . just simply run this command to run server :
$ python runserver
if successful , then simply run this :

That’s it .

Reference :


OmniAuth facebook/twiitter SSL certificate error

i have used Omniauth for facebook login . I followed this tutorial to integrate facebook login

I followed all the steps of that tutorial but after authorizing the app and when redirect to /auth/facebook/callback fails with:
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

This error we get because Omniauth/Oauth wasn’t setting the ca_path variable for OpenSSL of their HTTP calls.OpenSSL did not find the root certificate for Facebook’s SSL certificate.As a result we got this error.

We can solve the issue by two ways .

  • One way is we can set SSL certificate path
  • anothe one is ignore the certificaiton verification

Let’s see what will we do if we want to ignore the certification:

  • you can fix this in CBA’s application-config.
  • Add the following line to your file config/omniauth.rb

So now config/omniauth.rb will be look like :

Rails.application.config.middleware.use OmniAuth::Builder do
provider :facebook, "apikey", "secretkey"

what will we do to set the certification path :

take a look at this link ruby on rails and ssl error

    • sudo port install curl-ca-bundle
    • modify the config/omniauth.rb files
    • set ca_path in the client options
    • Rails.application.config.middleware.use OmniAuth::Builder do :
      facebook, FACEBOOK_KEY, FACEBOOK_SECRET, {:client_options => {:ssl => {:ca_path => "/opt/local/share/curl/curl-ca-bundle.crt"}}}

Hopefully this two ways can be solved the SSL certificate issue.


How to set up Zf2 (Zend Framework) in mamp server

Zend framework released their beta 2 version. I just planned to start work with that. Because I have seen lots of interesting features in zend framework . If you want to see more details about features then you may visit (

So I start to create a project with ZF2.0 . But I faced few problem to see the welcome screen . So here I describe how quickly you can set up a zf project .

First let us know the requirement of ZF 2.0


I assume that you have an idea for the following things :

1. how to setup mamp .
2. how to create virtual host .

Requirement :

1. Php 5.3

Download :

Setup on MAMP:

I just want to show how to set up on mamp . I assume that you already set up

1. Now open your php.ini file located under


2. Search for include_path and add the location of your zend framework:

include_path = ".:/usr/lib/php:/usr/local/lib/php:/Applications/MAMP/path of zendframework/ "

or you can include library/zend while you create a project . I will show in later while we create a project.

3. Zend Framework also comes with a shell script that will help you with RAD (Rapid Application Deployment), you can create a shortcut to Zend Tools in terminal by adding an alias to your profile under /etc/profile and make sure to restart terminal after you’ve done so:

alias zf2=/Applications/MAMP/svn/zendframework/trunk/bin/

4. Test if the Zend Tool is installed correctly by showing the version:

zf2 show version

5. Finally navigate to the directory you’d like to create your first project in:

zf2 create project quickstart

And then I create a virtual hosts for and when I browse that i have seen a blank page . Then I try to find the error . so I open the php error file by this command : tail –f php_error.log

In that file I have seen lots of error message where most of the error messages are that files are not found.

So I have checked the files. I open a file controllers/indexController.php file . There I find nothing has been written . Same things happened for error Controller . So I have looked at the:

. And there I found that how to extend the controller and also how to extend the class. So now again browse the and now I have seen it works for me .

Set Up a Local Facebook Development Environment with Virtual Host .

To create a facebook application , you need a real domain for Canvas URL. For that reasons  I have faced a real trouble to develop Facebook application . I have to change the code on the local machine, uploading them to the server, testing it out in a browser and repeating the process until finish the application. So Even a little change i have to do all  above the process . So i am  looking  for the best way to set up facebook development Environment in local to avoid all irritating process  .And finally i found out of box solution at the leevio . Here i describe the out of box solution  .

Create Only  Virtual Host :

1. Just only  create a virtual host in the localmachine according to you canvas domain name.That’s it nothing need to do more . It will save all of your effort and time   Like you set canvas url “myfbapps” .

Here is the instruction to create a virtual hosts at ubuntu . But you can create virtual host for any os

1. Open a new file and write down the server configuration

Server configuration:

<VirtualHost *:80>
DocumentRoot /www/ myfbapps

# Other directives here


2. Then save the file to /etc/apache2/sites-available. Give it a name like myfbapps

3. And then edit the file hosts under etc directory : /etc/hosts
4 . Open terminal and type the following command or copy and paste it.
sudo a2ensite smronju //change smronju to your file name.
5. Now you have restart your apache server the following command.
sudo /etc/init.d/apache2 restart

Few more reference link :

Facebook IFRAME Application Issues : PART-1

While I switch one of my fb application  from FBML to iframe , I have faced some silly problem. But to solve those problems , I have to waste so many hours. After searching the forum, asking mates and friends and then find out the solution.  I am thinking Mahedi hasan to help me a lot. When I got the solution I found that it’s a very 1 or 2 min jobs.   I have found mostly these problem arise in the beginning of application and basic issues. I hope so you will share your iframe problem too .

Here are the problems that I have faced  while developing an iframe application:

1. POST Submission problem :

While I submit the post data unfortunately I  do not get any post data. I have found that post field is empty. I am very surprised how my $_POST field is empty though it submit the action page.   I have given a sample form of my application.

Posting it via the server url:

<form action="" method="POST">
<input type="text" name="test1"></input>
<input type="submit" name="Submit"/>

Posting it via the app callback url:

<form action="" method="POST">
<input type="text" name="test1"></input>
<input type="submit" name="Submit"/>

After search in  facebook developer wiki,forum and blog , I have known that

while submit the form , iframe lost the session key as there is no session key passed . As a result it lost user id and lost all the post data. That’s why i have to set user_id. So below is the forum post link :

And  here Is how I solve this issue . This my modified form where I added two  hidden fields. One is fb_sig_session_key and another one is user_id.

Posting via fb_sig_session_key and user_id

<form action="" method="POST">
<input type="text" name="test1"></input>
<input type="hidden" name="fb_sig_session_key" value=”<?php $_GET[‘fb_sig_session_key’]”></input>
<input type="hidden" name="user_id" value=”<?php $_GET[‘user_id’]”></input>
<input type="submit" name="Submit"/>

So after submit the form here I show how can I set_user and now find the post values.


if (isset ( $_REQUEST ['kb_fb_sig_session_key'] )) {

$this->fb_sig_session_key = $_REQUEST ['fb_sig_session_key'];


if (isset ( $_REQUEST ['user_id'] )) {

$this->uid = $_REQUEST ['user_id'];


if ($this->uid != '') {

$this->facebook->set_user ($this->uid, $this->kb_fb_sig_session_key );


$this->facebook->set_user ($this->uid, $this->fb_sig_session_key );


2 . Application  Link  problem :

While I click on any link in my iframe application , I have found that it reloads the whole facebook page again in the iframe canvas. I just use this type of code and found the problem load  .

<a href=””>Invite</a&gt;

I found the solution in this thread :

Only add the taget=”__top” into the anchor.

So I add target=”_top”. <a href=””>Invite</a&gt;.   And now it work.

3.iframe size problem  :

I have faced problem to resize my frame application. Initially when page load the frame size is correct. But when I show the facebook profile photo of users , then find that it does not resize. I do not see the footer and it cut down. We have solve this problem by adding  javascript setTimer to resize the height. You have seen similar type problem here :

4.  Setting issues :

I think to set up my application as an iframe application, I do not need to set up the connect url. But when I do not set up connect url I see blank page. So when I set up the call back url , I have found that my application working.

I think to set up my application as an iframe application, I do not need to set up the connect url. But when I do not set up connect url I see blank page. So when I set up the call back url , I have found that my application working.

I have few more issues and will be add next topics.

Mooving my Carrier further

I am leaving the informatix software. Today is the last day of informatix software. I have passed a very wornderful moment at informatix. In the informatix I have spend my time like a family member. I got lots of help from the mizan bhai, Ehsan bhai,yunus bhai , khabir bhai , shojib bhai and sumon bhai. And passing a very memorable moment with them.  I am very much thankful to  all of them for their friendly behavior.

From the december i will join at the blueliner bangladesh team as a Senior software engineer. I am requestiing all of you to pray for me.

My new DELL XPS M1640

Finally i have gotten my new DELL Studio XPS 1620. I have been waiting for buying a laoptop so many days. And Mizan bhai help me to bring this laptop from USA. This laptop has been bought by from ebay. After 1 week waiting i have gotten my laptop.

The awsome design dell xps will forget you everything.It has Premium design with genuine leather accents, anodized aluminum, edge-to-edge display and backlit keyboard. The leater acents make it very unique desing and make it very luxarious goods. And the backlit keyborad make you always typing in the key board . Now i can even work in the dark night . So my roommate are happy to switch off the light while sleeping. And the 16”” with edge to edge display is very interesting.

Here is the features of My New Dell XPS M1640 Studio XPS 16 Intel® Core™ 2 Duo P7350 (3MB cache/2.0GHz/1066Mhz FSB) Genuine Windows Vista® Home Premium Edition SP1, 64-bit LCD Panel Edge-to-Edge HD Widescreen 16.0 inch WLED LCD (1366×768) W/2.0 MP MEMORY 3GB2 DDR3 SDRAM3 at 1067MHz (2 Dimms) Hard Drive 320GB5 7200 RPM6 SATA Hard Drive Battery Options 6-cell Batterydell-xps-13-16-1