Django 1.7 I just installed postgres, it works but I cannot see my data in postgres database

33 views
Skip to first unread message

Sabine Maennel

unread,
Mar 13, 2015, 6:29:17 AM3/13/15
to django...@googlegroups.com
I just switched from Sqlite to postgres. Everything is working except that when I open PgAdmin III all tables are still empty. I really wonder where are my data? 

In my settings file I have:
DATABASES = {
'default': {
#'ENGINE': 'django.db.backends.sqlite3',
#'NAME': os.path.join(BASE_DIR, 'dbsqlite3'),
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'postgres',
'USER': 'postgres',
'PASSWORD': (secret),
'HOST': 'localhost',
}
} 

So how can I check wether it is using the right database, where are my data?

I cannot find any tables in postgres. Please help me and tell me what I am getting wrong here.


John

unread,
Mar 13, 2015, 7:10:18 AM3/13/15
to django...@googlegroups.com
Sabine,

It is a really Bad Idea to use the postgres user and database for your data. Create a new user and database and use that instead.

John
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/904eed7d-b6b1-4726-8f81-1b1723bed47a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matthias Müller

unread,
Mar 13, 2015, 7:32:49 AM3/13/15
to django...@googlegroups.com
I do agree to John.

Check out the commands

  createuser --help

and

  createdb --help

Matthias

john

unread,
Mar 13, 2015, 9:25:52 AM3/13/15
to django...@googlegroups.com
Or just keep the database and create a new role with admin (I assume you need that) priv.
Johnf

john

unread,
Mar 13, 2015, 9:30:49 AM3/13/15
to django...@googlegroups.com
Have you issued the command to create the tables.
python manage.py makemigrations
python manage.py migrate

The above will create what ever tables you have in the models.

The actual data that something else?

Johnf

Sabine Maennel

unread,
Mar 14, 2015, 3:17:47 AM3/14/15
to django...@googlegroups.com
Thanks everybody, 

I will try to change the database and user name. I found the data. I had two installations of postgres.

                      I appreciate your help in this
                              Sabine  
Reply all
Reply to author
Forward
0 new messages