0

Still getting those logs, but my 500 page extends my base.html

2015-01-07T10:21:31.317465+00:00 heroku[router]: at=info method=GET path="/" host=sheltered-ravine-5921.herokuapp.com request_id=60e4b20d-f93a-408c-b8de-282c5efc52ce fwd="193.179.215.98" dyno=web.1 connect=2ms service=95ms status=500 bytes=1493
2015-01-07T10:21:31.527501+00:00 heroku[router]: at=info method=GET path="/static/ico/favicon.ico" host=sheltered-ravine-5921.herokuapp.com request_id=e461e7e0-6cf6-4cc5-b9a5-17ae826da9e0 fwd="193.179.215.98" dyno=web.1 connect=2ms service=5ms status=500 bytes=1493 

my main file

import os
import psycopg2

from flask import Flask, render_template, send_from_directory
from flask_sqlalchemy import SQLAlchemy

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['DATABASE_URL']
db = SQLAlchemy(app)

from views import *

db.drop_all()
db.create_all()

if __name__ == '__main__':
    app.debug = True
    app.run() 

and views.py

import os
from flask import Flask, render_template, send_from_directory
from flask import session, request, flash, url_for, redirect, render_template, abort ,g
from flask.ext.login import login_user , logout_user, current_user, login_required
from flask.ext.login import LoginManager
from jdutrunit import app, db
from models import User

login_manager = LoginManager()
login_manager.init_app(app)
login_manager.login_view = 'login'

@login_manager.user_loader
def load_user(id):
    return User.query.get(int(id))

@app.route('/')
#@login_required
def index():
    return render_template('index.html')

@app.route('/favicon.ico')
def favicon():
    return send_from_directory(os.path.join(app.root_path, 'static/ico/favicon.ico'))

@app.errorhandler(404)
def page_not_found(e):
    return render_template('404.html'), 404

@app.errorhandler(500)
def internal_error(error):
    db.session.rollback()
    return render_template('500.html'), 500

app tree

├── Procfile
├── forms.py
├── hello.py
├── jdutrunit.py
├── models.py
├── notes.txt
├── requirements.txt
├── static
│   └── ico
│       └── favicon.ico
├── templates
│   ├── 404.html
│   ├── 500.html
│   ├── base.html
│   ├── index.html
│   ├── login.html
│   └── register.html
└── views.py

so i still can't figure out why https://sheltered-ravine-5921.herokuapp.com/ can't stay on index.html

{% extends "base.html" %}
{% block title %} - Home {% endblock %}
{% block content %}
<h2>Ahoooj valecniku</h2>
{% endblock %}

and i am not sure how to get maximum from gunicorn, where to get logs from heroku

web: gunicorn jdutrunit:app --log-file=- --debug --error-logfile /tmp/gunicornerror --log-level debug

Thanks for help

pydevil
  • 1
  • 4
  • If you run `gunicorn jdutrunit:app` at your machine, the site works? – cuducos Jan 07 '15 at 10:49
  • 1
    [Enabling debug mode](http://stackoverflow.com/questions/8950674/debugging-a-flask-app-running-in-gunicorn), logging output to stdout [using `--log-file -`](https://devcenter.heroku.com/articles/python-gunicorn#adding-gunicorn-to-your-application-procfile) and viewing logs with [`heroku logs`](https://devcenter.heroku.com/articles/getting-started-with-django#view-the-logs) should work to get to the reason for your 500. – Lukas Graf Jan 07 '15 at 10:52
  • heroku logs are the same, i have set environment on Cloud9, not set yet for local starting of server – pydevil Jan 07 '15 at 11:29
  • i have found that i could have problem with external sources Mixed Content: The page at 'https://sheltered-ravine-5921.herokuapp.com/' was loaded over HTTPS, but requested an insecure stylesheet 'http://twitter.github.io/bootstrap/assets/css/bootstrap.css'. This request has been blocked; the content must be served over HTTPS. can someone explained to me? – pydevil Jan 07 '15 at 11:30
  • ok, i solve last one with Flask-Bootstrap, but 500 stays – pydevil Jan 07 '15 at 12:13

1 Answers1

0

i got it, missing part:

app.secret_key = 'abrakadabra'
pydevil
  • 1
  • 4