Wednesday, June 30, 2010

Re: DATABASE_ROUTERS in settings.py results in Internal Server Error

Hi,

If your project is named myproject and your app is named myapp where
the router is contained. Then you need to set it to the following and
you need to include the Classname as well. So if your AppRouter is
like this which is in the directory myproject.myapp:

AppRouter.py:
Class Router(object)
....

then your settings file should be as follows:

DATABASE_ROUTERS = ['myproject.myapp.AppRouter.Router']

Also it should display more than internal server error if you have
DEBUG set to True.

I hope this helps.

Cheers,
Nathan.

On Jun 30, 10:44 am, Michael <hexvec...@gmail.com> wrote:
> I tried to configure a database router according tohttp://docs.djangoproject.com/en/dev/topics/db/multi-db/#an-example.
>
> All my attempts lead to the Django project outputing "Internal Server
> Error" generic message with no further info.
>
> If my project is named 'myproject' and my app named 'myapp' how should
> I configure the DATABASE_ROUTERS setting?
>
> I have a AppRouter.py in the folder: myproject/AppRouter.py
> The absolute path to AppRouter.py is: /home/username/webapps/django/
> myproject/AppRouter.py
>
> My settings.py has the line:
> DATABASE_ROUTERS = ['myproject.AppRouter',]
>
> But it doesn't work. How do I configure a 'python path' is it absolute
> or relative?
>
> Thank you.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment