1

I'm working on cs50 project1 (js & python), I download the project, and found this line in it:

engine = create_engine(os.getenv("DATABASE_URL"))

the question is how to set up the DATABASE_URL?

Hussein Saad
  • 151
  • 2
  • 15

2 Answers2

5

add this code after initialising your app:

app.config['DATABASE_URL'] = "path_to_db"

Or export it by running in your command line:

export DATABASE_URL=""postgres://user:password@server_ip:5432/table_name""

bigEvilBanana
  • 388
  • 2
  • 8
2

If you use Linux you could set variable in environment via:

 $ export DATABASE_URL="postgresql://localhost/yourdatabase"
Rafał
  • 685
  • 6
  • 13