Note that there are some explanatory texts on larger screens.

plurals
  1. POHeroku Application Crashes Because of Database
    primarykey
    data
    text
    <p>My code works locally, but when I try running it on Heroku it does not work.I have added a db on heroku, but it still won't work. Any clues to why this happens?</p> <pre><code>import sys import os from flask import Flask, render_template from flask.ext.sqlalchemy import SQLAlchemy db_local = #it works, just not shown here app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URL', db_local) app.secret_key = ' ' #it's a secret for a reason db = SQLAlchemy(app) from views import * from model import * db.create_all() if __name__ == '__main__': port = int(os.environ.get('PORT', 5000)) app.run(host='0.0.0.0', port=port, debug=True) </code></pre> <p>Some of my heroku logs</p> <pre><code>2013-02-19T22:29:59+00:00 app[web.1]: File "app.py", line 23, in &lt;module&gt; 2013-02-19T22:29:59+00:00 app[web.1]: from views import * 2013-02-19T22:29:59+00:00 app[web.1]: File "/app/views.py", line 1, in &lt;module&gt; 2013-02-19T22:29:59+00:00 app[web.1]: from app import db 2013-02-19T22:29:59+00:00 app[web.1]: File "/app/app.py", line 25, in &lt;module&gt; 2013-02-19T22:29:59+00:00 app[web.1]: db.create_all() 2013-02-19T22:29:59+00:00 app[web.1]: self._execute_for_all_tables(app, bind, 'create_all') 2013-02-19T22:29:59+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/flask_sqlalchemy.py", line 822, in create_all 2013-02-19T22:29:59+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/flask_sqlalchemy.py", line 814, in _execute_for_all_tables 2013-02-19T22:29:59+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/sqlalchemy/schema.py", line 2564, in create_all 2013-02-19T22:29:59+00:00 app[web.1]: import utils 2013-02-19T22:29:59+00:00 app[web.1]: File "/app/utils.py", line 1, in &lt;module&gt; 2013-02-19T22:29:59+00:00 app[web.1]: Traceback (most recent call last): 2013-02-19T22:29:59+00:00 app[web.1]: conn = self.contextual_connect(close_with_result=False) 2013-02-19T22:29:59+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 2490, in contextual_connect 2013-02-19T22:29:59+00:00 app[web.1]: self.pool.connect(), 2013-02-19T22:29:59+00:00 app[web.1]: tables=tables) 2013-02-19T22:29:59+00:00 app[web.1]: con = self._create_connection() </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload