kwenholz
kwenholz

Reputation: 162

'site' module not found when deploying to Heroku

I'm trying to deploy a django app to Heroku, but I keep getting the error

ImportError: no module named site

I'm using a custom buildpack from https://github.com/jiaaro/heroku-buildpack-django

This doesn't seem to be the problem and neither does anything with pip or my virtualenv setup I think the error is originating in my main urls.py file. This file is set up just like below:

from django.conf.urls import patterns, include, url
from django.contrib import admin
from CentsLess import settings

admin.autodiscover()

urlpatterns = patterns('',
    # BASICS #
    url(r'^admin/', include(admin.site.urls)), 
. . . 

Some help learning how to better interpret the error log from Heroku or what may be wrong in urls.py would be very appreciated. It all works fine on my local setup, even with gunicorn and such.

Upvotes: 4

Views: 920

Answers (2)

StefanNch
StefanNch

Reputation: 2609

SITE_ID = 1
INSTALLED_APPS = (
    ...
    'django.contrib.sites',
    ...
}

make sure you add in your database (table "django_site") a site with the same id as SITE_ID.

Upvotes: 3

Intenex
Intenex

Reputation: 1947

Do you have a full error log? You're getting that error because somewhere you're trying to do an 'import site' and python can't find 'site'. Could be anywhere, in views/urls/etc - try doing a text search for 'import site' in your project directory and see if anything turns up.

http://docs.python.org/library/exceptions.html#exceptions.ImportError

Upvotes: 0

Related Questions