I am in SQL lecture. While watching the video, This is shown

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

How does his code execute while DATABASE_URL is invalid. How do I practice while watching the lecture video?

  • Look at project 1 it has instructions for connecting to a postgres database hosted on Heroku. – DinoCoderSaurus Apr 26 '20 at 20:27
  • @DinoCoderSaurus saw that. But shouldn't that be in Notes of SQL lecture too? I practice each code explained in the lectures and had hard time figuring things out this time. Sad. – TheOnlyAnil Apr 27 '20 at 5:50
  • in your terminal you have to set DATABASE_URL to something (in this case your specific URL given in your Heroku account in that specific project database). Ex: in Windows Command Prompt you have to type set DATABASE_URL=asdfghjkl where asdfghjkl is your database url in the Heroku account. Once you do it, unless you change directories or want to change the database url, you won't have to type it again. Perhaps that's why you didn't see Brian do it in the video bc it was something he did once ages ago and didn't demonstrate. – azb1297 May 4 '20 at 17:43

You must log in to answer this question.

Browse other questions tagged .