Tuesday, October 01, 2013

Django Firebird and pyinstaller notes

After installing pyinstaller in python 2.7.x

pip  install pyinstaller
c:\\python27\\scripts\\pyinstaller --version

You need Firebird client installed : run firebird installer

pip install django
pip install fdb
pip install django-firebird

my application is using django-postman and is named that way

c:\\python27\\scripts\\pyinstaller -d --name=django_postman manage.py

I had a issue with Cookie and django 1.5.x (ImportError: No module named Cookie )

ls -lah
-rwxrwxr-x 1 mariuz mariuz 2.9M Oct  1 13:28 dist/django_postman/django_postman.exe

There are some issues with ctypes dependency support in fdb

So i had to modify in drive_c/Python27/Lib/site-packages/fdb/ibase.py

these lines

    #fb_library_name = find_library('fbclient.dll')
    fb_library_name = 'C:\\windows\\system32\\fbclient.dll'
    fb_library_name = find_library('fbclient')
if sys.platform in ['win32', 'cygwin', 'os2', 'os2emx']:
#    fb_library = WinDLL(fb_library_name)
    fb_library = WinDLL('fbclient.dll')

here is my manage.py config

Flask and pyinstaller notice

I have started to test flask and pyinstaller setup in wine/linux

first i needed to install flask with pip

wine cmd.exe
c:\\python27\\scripts\\pip install flask

then after i have created the hello world flask needs to be added in the --hidden-import at command line like this

c:\\python27\\scripts\\pyinstaller --hidden-import=flask --onefile -d -y hello.py

and you can start it with
* Running on

Then load in your browser :) The size of the single file binary
ls -lah hello.exe 
-rwxrwxr-x 1 mariuz mariuz 5.6M Oct  1 18:03 hello.exe