1

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)?

1 Answer 1

1

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
Sign up to request clarification or add additional context in comments.

2 Comments

thanks for the answer. i tried that before but the schema already exists: postgres=# create schema public; ERROR: schema "public" already exists
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.