I had my Django app running on Heroku, but now I want to migrate it to my own web server. Everything went fine except the PostgreSQL database: I exported the database from Heroku and imported the dump file into my own PostgreSQL. When I run python manage.py syncdb i get the following error:

django.db.utils.ProgrammingError: no schema has been selected to create in

When I open any page in my browser I get this error:

relation "django_session" does not exist
LINE 1: ...ession_data", "django_session"."expire_date" FROM "django_se...

What is the best way to migrate the app (and the database)?

share|improve this question

You probably don't have a public schema in your database. Run this in your database to create it:

CREATE SCHEMA public;

After that you don't need to run syncdb, just run:

./manage.py migrate
share|improve this answer
    
thanks for the answer. i tried that before but the schema already exists: postgres=# create schema public; ERROR: schema "public" already exists – wildthing Dec 26 '14 at 11:38
1  
I followed a setup tutorial that told me to type (after going into my database with \c mydb) REVOKE ALL ON SCHEMA public FROM PUBLIC; - this led to the same error you were having, I just went back in and typed GRANT ALL ON SCHEMA public to PUBLIC; and it worked – amchugh89 Oct 22 '15 at 8:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.