On 18 Jan 02:26, Carl Karsten wrote:
>
> I am trying to write a shell script that do whatever needs to be done between
> sudo apt-get install postgresql python-psycopg
> and
> manage.py syncdb
>
> for MySql, I use this to generate somehting I can pipe into the CLI:
>
> print """
> DROP DATABASE IF EXISTS %(db)s;
> CREATE DATABASE %(db)s;
> GRANT ALL
> ON %(db)s.*
> TO %(user)s
> IDENTIFIED BY '%(pw)s'
> with grant option;
> """ % {
> 'db':settings.DATABASE_NAME,
> 'user':settings.DATABASE_USER,
> 'pw':settings.DATABASE_PASSWORD }
>
> pipe that into the MySql CLI.
>
> I can't figure out how to do it with psql without it prompting me for input.
psql will happily take piped input - you might need to edit
/etc/postgres/pg_hba.conf (or similar location) and you might need to
add your user - if it's prompting for a password then the only way I
know of getting round the password issue is to specify it as the
environmental variable PGPASSWD.
Hope that helps,
--
Brett Parker
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---