Search code examples
databasedjangoconfigurationwebfaction

django, multiple databases, configuration issue: "Error importing database router"


I've followed these instructions to set up Django with multiple databases. It's working as intended in my local dev environment (win7), however, when I upload the project to my live server (webfaction), I get

ImproperlyConfigured: Error importing database router MyCustomRouter: "No module named path.to.my.router"

From the Django shell, I can import MyCustomRouter:

>>> from path.to.my.router import MyCustomRouter
>>>

I'm running django 1.2.1 and python2.6 both locally and on live server...

Any hints what could be causing this behavior or how to debug are be greatly appreciated!

Cheers,

Martin


Solution

  • I had the same problem. I had defined a router in models.py. Moving the class definition into its own file (I named mine router.py), and updating settings.py accordingly, resolved the error.