Reputation: 1427
I've spent a solid week trying to deploy an Django app on Heroku from my mac osx. I went through series of trial and error and finally came to the conclusion that I should just give up. By way of background, I am using bitbucket, and mysql. I read that Heroku was easy to use and most django developers suggested that a beginner like myself should use Heroku and Amazon S3. So I took that advice and started deploying my django polls app on Heroku. I later found out that Heroku works well with PosgreSQL but there were hardly any docs on how to make it work with mysql. I ran into trouble from the start with uploading my app and ignoring changing the database setting in my settings.py file. I was hoping maybe it will just work :) But sadly that was not the case and So I decided to change my database from mysql to PosgreSQL by installing PosgreSQL (which I am not familiar with) and that did not fix my problem.
I tried installing postgresql-9.3.3-1-osx at http://www.enterprisedb.com/products-services-training/pgdownload#osx
But I still could not deploy:
raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: No module named psycopg2
So I tried installing psycopg2 and it gave me more errors about pg-config:
Command python setup.py egg_info failed with error code 1 in /private/var/folders/m3/_ymmjf2s74g9fvx44dysy_v80000gn/T/pip_build_vantran/psycopg2
Storing debug log for failure in /Users/vantran/.pip/pip.log
So to sum this up, I've given up hope of using Heroku. I must believe that there are loads of people out there who have similar situation struggling to deploy where they just can not get Heroku to work. *I hope Heroku reads this *
So my question to the django deployment guru out there, I really need some instructional advice on how to deploy my app. Could you please help me? Ideally I like to use django and mysql. I've heard of Amazon EB but after looking into the issue, it seems that there are also many users with issues deploying using elastic beanstalk. I actually tried install EB, but I got this a prompt after following the instruction on amazon website.
Thanks for your help.
Upvotes: 1
Views: 601
Reputation: 659
I received the same django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: No module named psycopg2
error as you when trying to deploy a basic app to Heroku. I was not using PostgreSQL but I believe it is a dependency of the Heroku toolbelt. The issue may be that when you tried to build up your virtualenv using pip install -r requirements --allow-all-external
as specified in Heroku's docs it didn't pull in psycopg2
. I'm not sure why this happens.
The fix is to force-install psycopg2
into your virtualevn manually by running pip install psycopg2 --ignore-installed
so that it ignores what's available on your local path.
I know this is probably too late for you but hopefully it helps someone else.
Upvotes: 0