On Sat, Jun 1, 2013 at 4:37 PM, maneesha sane <[email protected]> wrote:
> When I run python manage.py syncdb I get the expected output (Creating
> Tables, Installing Indexes, etc) However, the tables are not created in my
> heroku database. They are created in another local postgres database called
> 'shows' which is not connected to this project or app. It's a dummy database
> I created earlier just while I was exploring how things work. I have no idea
> why this project is looking for the database 'shows'. So then I dropped that
> db from postgres and now I get this message when I try to run python
> manage.py syncdb:
>
> OperationalError: FATAL: database "shows" does not exist
>
> So then instead of running just python I thought of trying heroku run
> python.
This is the common recommended way (because it gets your environment
on Heroku automatically).
Often, setting the environment locally to do maintenance is error
prone and not really necessary, although it's entirely doable and can
be made safe with care.
> When I run heroku run python manage.py sqlall books I get this message:
>
> CommandError: App with label books could not be found. Are you sure your
> INSTALLED_APPS setting is correct?
You might need to fix this before continuing, otherwise, if memory
serves, Django will not synchronize the models.
> When I run heroku run python manage.py syncdb I get this output:
>
> Running `python manage.py syncdb` attached to terminal... up, run.7207
> Creating tables ...
> Installing custom SQL ...
> Installing indexes ...
> Installed 0 object(s) from 0 fixture(s)
>
> But when I go into the db shell with
>
> heroku pg:psql HEROKU_POSTGRESQL_GREEN
>
> or
>
> heroku pg:psql DATABASE_URL
>
> or
>
> heroku pg:psql HEROKU_POSTGRESQL_GREEN_URL
>
> and look for all tables (using \dt) the tables from my books model are not
> there. I have no idea what database they are being created in.
One does not nominally have control over CREATE DATABASE on Heroku, so
the one database credential you are getting is the right one.
> I have been reading the docs that explain that heroku run is for one-off
> processes, but I admit I'm still not really sure what that means and how it
> is different from just running python.
In a nutshell, 'heroku run' passes the subsequent arguments to a
freshly created Dyno (which is a lxc-styled Linux container) and then
attaches its terminal output to your terminal, and vice versa.
Keystrokes are sent directly to the other side, and then the resultant
change on the terminal is rendered after that round-trip to Heroku.
They're called one-shot because the process manager makes no attempt
to keep a target number of those processes alive should they
terminate, unlike "heroku ps:scale web=3", where the number of 'web'
processes is made to equal '3' as often as possible, such as after one
of them exits or its corresponding hardware suddenly disappears.
>>>> from django.conf import settings
>>>> print settings.DATABASES['default']
> {'PASSWORD': 'OMR7r_d1tKVSa-NFfXI_FqYn2i', 'TEST_CHARSET': None, 'PORT':
> 5432, 'HOST': 'ec2-54-227-252-82.compute-1.amazonaws.com', 'OPTIONS': {},
> 'TIME_ZONE': 'UTC', 'ENGINE': 'django.db.backends.postgresql_psycopg2',
> 'TEST_NAME': None, 'NAME': 'd3ukewj9guulmo3', 'TEST_MIRROR': None, 'USER':
> 'sndetajgwxlayz', 'TEST_COLLATION': None}
This contains a password :( you should probably rotate it with 'heroku
pg:credentials --reset'.
--
--
You received this message because you are subscribed to the Google
Groups "Heroku" group.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/heroku?hl=en_US?hl=en
---
You received this message because you are subscribed to the Google Groups
"Heroku Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.