pppp
pppp

Reputation: 677

finding local postgresql “database_url”

I'm following these instructions (https://github.com/assemblymade/assemblycoins) to get a postgresql server connected.

I am told to: "set DATABASE_URL local variable to postgres database url"

I'm not too sure where to find this, it doesn't seem like an easy thing to find. (Sorry, i'm pretty new to Postgresql if this is a real amateur question)

For a bit more context, I installed postgresql from Enterprise DB and can successfully run a postgresql database on PGAdmin.

Upvotes: 24

Views: 52573

Answers (5)

Ditttt
Ditttt

Reputation: 31

This is the method I often use:

postgres://[user]:[password]@[host]:[port]/[database]

Upvotes: 3

Marichyasana
Marichyasana

Reputation: 3154

Looking at file main.py line 22 contains "os.environ['DATABASE_URL']" you should set the environment variable DATABASE_URL on your computer to a value that is the location of your database. Eg: set DATABASE_URL=C:\Users\Philip\mydatabasefile

Upvotes: 3

Blaine McMahon
Blaine McMahon

Reputation: 197

You can display your connection info if logged into postgres shell with command:

\conninfo

this will display the database you are connected to as well as the user logged on

Upvotes: 13

user8851623
user8851623

Reputation: 802

This is the most up to date URI format for sqlalchemy

Replace the following variables: 1. username 2. password 3. dbname

URI postgresql+psycopg2://username:password@localhost/dbname

Upvotes: 1

Thomas Morrison
Thomas Morrison

Reputation: 647

See The docs The general form for a connection URI is:

postgresql://[user[:password]@][netloc][:port][,...][/dbname][?param1=value1&...]

You probably need to set you environment variable DATABASE_URL to something like

set DATABASE_URL=user:password@localhost/dbname

Upvotes: 10

Related Questions