views:

268

answers:

1

I'm currently running my Django 1.1.1 site with PostgreSQL 8.4.2 both on the live server and locally. When I try to restore one of my backup from the live server on my local box, I get the following error while accessing my site locally(http://localhost:8000):

Exception Type: ProgrammingError at /
Exception Value: permission denied for relation django_session

I also get a similar error while accessing all the contents of one of my models:

$ python manage.py shell
Python 2.6.4 (r264:75706, Dec  7 2009, 18:45:15) 
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from myapp.models import MyModel
>>> MyModel.objects.all()
...
ProgrammingError: permission denied for relation myapp_mymodel

I used pg_dump for backup on the live server and dropping my local db followed by psql dbname < infile for restore. Does anyone know what's wrong?

+1  A: 

Do you get the same error when connecting with psql as the same user (the user Django connects as)? Or do you have the same PostgreSQL users on your live site and your local machine? If not, you should dump/reload with the -Ox (or --no-owner) option to skip the ownership commands.

copelco