0

My Django project on Heroku I want to migrate from SQLite to PostgreSQL. I changed my settings.py to PostgreSQL. On Windows I installed PostgreSQL and psycopg2. I created the database manually.

As I run makemigrations it creates an SQLite database. Why?

1

2 Answers 2

0

After you have run python manage.py makemigrations you need to run python manage.py migrate to apply the data to the new database.

Sign up to request clarification or add additional context in comments.

1 Comment

done that ofcourse, but it is creating a sqlite db instead of postgres
0

@Dacey you'll need to edit the settings.py file and change the database name (and potentially connection).

Database https://docs.djangoproject.com/en/4.1/ref/settings/#databases

''' here you use triple quotes to block out your original statement
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': BASE_DIR / 'old_sqlite.db',
    } } 
close your triple quotes    ''' 

Change the above to something like this

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'PostGres_New',
'USER': 'postgres',
'PASSWORD': 'postgres',
'PORT':'5432',
'HOST':'localhost',
    } }

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.