Friday, March 22, 2013

Re: DB Weirdness



On Fri, Mar 22, 2013 at 7:46 PM, Tim Cook <tim@mlhim.org> wrote:
HI All,

Sorry I couldn't think of a better subject.  :-)

I am fairly new to Django.  I have done most of the tutorial and
started reading Two Scoops of Django (TSD).

Of course being impatient I also started my project, in parallel.

Danny made a good point in TSD about using the same database in
development as in production.  So I went ahead and installed Postgres
(Ubuntu 12.04)

Restarted the tutorial and the database looks fine in PGAdminIII.  But
when I check my project database, there are no tables in PGAdminIII.
However, my project app runs just fine. I can add, update and delete
records as expected (through the admin interface).

So, I am curious as to why PGAdminIII doesn't show the tables???

This kind of weirdness tells me, from experience,  I have done
something really silly. But I have no clue what.
BTW: This is the first time I have used Postgres in about 6 years.  So
I am almost a newbie with SQL DBs again.

It's difficult to know for certain without seeing your exact setup - but one likely possibility is that you're using different databases.

You're obviously successfully running the PostgreSQL server, because both PGAdminIII and Django are connecting to it -- if the server wasn't running, you'd be getting connection errors. However, a single server can host multiple databases. 

The default PostgreSQL database is called, unsurprisingly, 'postgres' -- that's the database that the psql command line tool connects to by default, and I'd wager PGAdminIII does the same.

However, I'm guessing that this *isn't* the name of the database that you've got Django configured to use. If you're following the tutorial (and following the same lessons for your project), you will have invoked "CREATE DATABASE database_name" at some point -- creating a new database, and *that* is the database Django is using.

So - I'm guessing the solution here is to point PGAdminIII at the database you created, instead of the default database. Unfortunately, I haven't used PGAdminIII, so I can't give you any practical tips on that front.

Yours,
Russ Magee %-)

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment