Saturday, May 23, 2015

Deploying psycopg2 to Azure Webapp

Another challenge with Azure-Django-Postgres deployment is to install psycopg2. Azure is running on windows and IIS, hence any existing psycopg2 installation with PIP will not work. As the solution of this, I removed the psycopg2 from the requirements.txt and used easy_install to install the driver from http://www.stickpeople.com/projects/python/win-psycopg/

I added the following to the deployment script: deploy.cmd

:: Addition psycopg2 for windows
echo Pip install git+https://github.com/nwcell/psycopg2-windows.git@win32-py27#egg=psycopg2
env\scripts\easy_install http://www.stickpeople.com/projects/python/win-psycopg/2.6.0/psycopg2-2.6.0.win32-py2.7-pg9.4.1-release.exe

IF !ERRORLEVEL! NEQ 0 goto error

Hope, this will help you to kick start the Azure for your existing this Django migration.

No comments: