title: How should I set my DATABASE_URL?
body: <p>I'm working on my first-ever Heroku/Django app. I just want to be sure I'm setting my <code>DATABASE_URL</code> and <code>DATABASES</code> variables correctly. Here's what's in my code:</p>
  
  <pre><code>import dj_database_url
  
  DATABASE_URL = 'postgresql:///my_app'
  
  # Parse database configuration from $DATABASE_URL
  DATABASES = {
      'default': dj_database_url.config(default=DATABASE_URL)
  }
  </code></pre>
  
  <p>When I just have <code>DATABASES['default'] = dj_database_url.config()</code> and I try to use Django commands like <code>run server</code> or <code>migrate</code> I get the following error: <code>NameError: name 'DATABASES' is not defined</code>. I set the <code>DATABASE_URL</code> since doing so appears to solve this issue (after I create the <code>my_app</code> database).</p>
  
  <p>Everything appears to be working fine as I code and test, but I've also seen a half-dozen different ways to set the database variables on the internet. If this isn't correct, I'd like to fix it now. The thing that really confuses me is, when I push my app to Heroku, how will the data get pushed to the web, when the database is /usr/local/var/postgres? Or will this not happen at all? Am I just too confused/tired at this point?</p>