Environment - Win 10, Python 2.7

Passing the GeoDjango tutorial. Installed PostgreSQL 9.5, psycopg2, GEOS, PROJ.4, GDAL (last three via OSGeo4W) and postGIS 2.2.

Reached the section Create a Spatial Database ( https://docs.djangoproject.com/en/1.8/ref/contrib/gis/tutorial/#create-a-spatial-database )

And further at an impasse, because green in PostgreSQL and do not understand what to do and where to do.

At the beginning we have the instruction:

$ createdb -T template_postgis geodjango 

But at the same time, the link: https://docs.djangoproject.com/en/1.8/ref/contrib/gis/install/postgis/#speddb- template

we get this instruction:

 $ createdb <db name> $ psql <db name> > CREATE EXTENSION postgis; 

I tried to enter these commands in the shell after entering the psql command, but nothing happens, I don’t see any answer that something was created there, etc.

just moving to a new line postgres = #

Explain, pzhlst, teapot what commands and where you need to enter.

PS and another incomprehensible thing - when I installed PostgreSQL I left the login as it was set by default - 'postgres'. But when I enter the 'psql' command in the shell, a password is required .. I enter 'postgres' (the password I set during the installation) and I cannot pass because it turned out that it uses the name of my computer, not postgres. And to log in, I have to enter the psql command with --username == 'postgres'. And then, by entering the postgres password accordingly, I enter into postgres = # (where I try to enter the above commands:

$ createdb geodjango

$ psql geodjango> CREATE EXTENSION postgis;

)

Thank!

    1 answer 1

    In postgresql, each command must end with a semicolon.

    A new line is issued as postgresql is waiting for the command to continue.

    In your case

     $ createdb -T template_postgis geodjango;