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.
Use \l or \l+ in psql to show all databases in the current PostgreSQL server. Use the SELECT statement to query data from the pg_database to get all databases.
basically just type "systemctl status postgresql-xx" where xx is the version of your PostgreSQL instance. ex: systemctl status posgresql-10.
The PostgreSQL database service is available on localhost and the default PostgreSQL port is 5432 . A default user ( hosting-db ) and database ( postgres ) exist so you can quickly test your connection and perform management tasks.
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
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
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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With