flask web教程 第十一章,添加博客文章 报错UndefinedError: 'Permission' is undefined

我根据github源码来的怎么还出错了,已经更新了数据库。访问首页就报错了

            Traceback (most recent call last)

File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask\app.py", line 1997, in call
return self.wsgi_app(environ, start_response)
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask\app.py", line 1985, in wsgi_app
response = self.handle_exception(e)
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask\app.py", line 1540, in handle_exception
reraise(exc_type, exc_value, tb)
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask_compat.py", line 33, in reraise
raise value
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask\app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask\app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask\app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask_compat.py", line 33, in reraise
raise value
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask\app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask\app.py", line 1598, in dispatch_request
return self.view_functionsrule.endpoint
File "E:\zt_6.27\pictureme\app\main\views.py", line 20, in index
return render_template('index.html', form=form, posts=posts)
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask\templating.py", line 134, in render_template
context, ctx.app)
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask\templating.py", line 116, in _render
rv = template.render(context)
File "E:\zt_6.27\pictureme\flask\lib\site-packages\jinja2\environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "E:\zt_6.27\pictureme\flask\lib\site-packages\jinja2\environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "E:\zt_6.27\pictureme\flask\lib\site-packages\jinja2_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "E:\zt_6.27\pictureme\app\templates\index.html", line 2, in top-level template code
{% import "bootstrap/wtf.html" as wtf %}
File "E:\zt_6.27\pictureme\app\templates\base.html", line 1, in top-level template code
{% extends "bootstrap/base.html" %}
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask_bootstrap\templates\bootstrap\base.html", line 1, in top-level template code
{% block doc -%}
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask_bootstrap\templates\bootstrap\base.html", line 4, in block "doc"
{%- block html %}
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask_bootstrap\templates\bootstrap\base.html", line 20, in block "html"
{% block body -%}
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask_bootstrap\templates\bootstrap\base.html", line 23, in block "body"
{% block content -%}
File "E:\zt_6.27\pictureme\app\templates\base.html", line 58, in block "content"
{% block page_content %}{% endblock %}
File "E:\zt_6.27\pictureme\app\templates\index.html", line 11, in block "page_content"
{% if current_user.can(Permission.WRITE) %}
File "E:\zt_6.27\pictureme\flask\lib\site-packages\jinja2\environment.py", line 430, in getattr
return getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'Permission' is undefined

求大神解答一下!!!!

2个回答

zhangtao0417
zhangtao0417 额,大佬,答非所问啊,虽然都是undefined,但是不同项目环境的也没用啊,我想问一下接触过flask web教程这本书的大佬们有没有遇到类似的错误
一年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
flask教程数据库部分报错
http://www.pythondoc.com/flask-mega-tutorial/database.html#id2 按照这个教程上db_migrate.py的代码 运行之后报错 Traceback (most recent call last): File "./db_migrate.py", line 11, in <module> script = api.make_update_script_for_model(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO, tmp_module.meta, db.metadata) AttributeError: 'module' object has no attribute 'meta'
flask web 狗书第七章的邮箱不能发送
根据狗书上的比较第六章和第七章的改动,并且set username和password之后依旧没有邮件反馈,也没有提示报错,不知道到底是哪里出了问题![图片说明](https://img-ask.csdn.net/upload/201906/18/1560865279_177886.png)![图片说明](https://img-ask.csdn.net/upload/201906/18/1560865287_161568.png) ![图片说明](https://img-ask.csdn.net/upload/201906/18/1560865313_923246.png)
python flask 网页报错
# 如图,我在python flask写的网页点击提交按钮后显示如图错误![点击提交按钮后显示如图](https://img-ask.csdn.net/upload/201612/23/1482426458_206238.png) # 查找错误,指向118行,![图片说明](https://img-ask.csdn.net/upload/201612/23/1482426537_664832.png) 前往118行,![图片说明](https://img-ask.csdn.net/upload/201612/23/1482426572_535955.png) 其中,c2是我用pymongo获取的mongodb的一个collection, c2里有{'name':'string'}按键值对。理说temp是一个字典,对于字典用temp['name']获取字典指定'name'键的值应该没错,为何说无法游标?而且这个程序在我关机之前可以运行,关机重启之后就报错。
使用flask的request对象的method属性报错
刚学flask写了个简单的demo #-*- encoding = UTF-8 -*- from flask import Flask,render_template,request import request app = Flask(__name__) @app.route('/login/',methods=['POST', 'GET']) def login(): if request.method == 'POST': if request.form['user'] == 'admin': return 'Admin login successfully!' else: return 'No such user!' title = request.args.get('title', 'Default') return render_template('login.html', title=title) if __name__ == '__main__': app.run(debug=True) 结果报错AttributeError AttributeError: 'module' object has no attribute 'method'
flask响应return时老是报相同的错:TypeError: The view function did not return a valid response. The function either returned None or ended without a return statement.
flask响应return时老是报相同的错:TypeError: The view function did not return a valid response. The function either returned None or ended without a return statement. python代码为: ![在这里插入图片描述](https://img-blog.csdnimg.cn/20200124022917753.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQzMjQ0MTQ3,size_16,color_FFFFFF,t_70) html代码: ![在这里插入图片描述](https://img-blog.csdnimg.cn/20200124022948221.png) 奇怪的是另一个与这样相同的响应可以成功跳转,但只有这个不行…… 求助!!!
Python 运用pip install Flask-MySQLdb报错
如图所示,Python 运用pip install Flask-MySQLdb报错,本人已安装了Microsoft Visual C++ Compiler Package for Python 2.7![图片说明](https://img-ask.csdn.net/upload/201710/24/1508813254_220461.png)![图片说明](https://img-ask.csdn.net/upload/201710/24/1508813323_513292.png)
flask蓝图模式下,怎么使用pymongo
``` from flask import Flask from flask-pymongo import PyMongo app = Flask(__name__) app.config.update( MONGO_HOST='localhost', MONGO_PORT=27017, MONGO_USERNAME='bjhee', MONGO_PASSWORD='111111', MONGO_DBNAME='flask' ) mongo = PyMongo(app) ``` 这是直接在入口文件里写的方法 现在加入里蓝图 home.py ``` from flask import Blueprint import mysql.connector, logging from flask_pymongo import PyMongo import app home = Blueprint('home', __name__, url_prefix='/home') mongo = PyMongo(app) // 这里应该怎么写 因为不存在app @home.route('/test') def move_tickets_to_mongo(): res = mongo.db.acct_data_logs.find({}) ``` 这里会报错, 因为找不到app
flask-socketio中文乱码问题
前端没有问题,但是只要通过socketio传到后端,中文就会变为乱码。 在自己win10测试没有这个问题,部署在server2019的服务器上就乱码了 求解决
python flask包使用。。。。。
![图片说明](https://img-ask.csdn.net/upload/202002/06/1580974180_632939.jpg)![图片说明](https://img-ask.csdn.net/upload/202002/06/1580974198_207304.png)![图片说明](https://img-ask.csdn.net/upload/202002/06/1580974206_672162.png) 按书中,在jupyter中写了段使用flask包的代码,放在cmd中运行不出,请问这个问题如何解决
web开发时sqlalchemy报错
原本运行正常的web服务,在数据库模型中加了一行之后报错: sqlalchemy.exc.OperationalError sqlalchemy.exc.OperationalError: (OperationalError) no such column: comments.confirmed 'SELECT count(*) AS count_1 \nFROM (SELECT comments.id AS comments_id, comments.author_id AS comments_author_id, comments.post_id AS comments_post_id, comments.confirmed AS comments_confirmed \nFROM comments \nWHERE ? = comments.post_id) AS anon_1' (104,) 用的是python内置sqlite,代码如下: class Comment(db.Model): __tablename__ = 'comments' id = db.Column(db.Integer, primary_key=True) body = db.Column(db.Text) body_html = db.Column(db.Text) timestamp = db.Column(db.DateTime, index=True, default=datetime.utcnow) disabled = db.Column(db.Boolean) author_id = db.Column(db.Integer, db.ForeignKey('users.id')) post_id = db.Column(db.Integer, db.ForeignKey('posts.id')) confirmed = db.Column(db.Boolean, default=False) ##就只是加了这一行,添加后也更新过数据库模型 shell中能查到这一列: (venv) F:\flask\flask1>python manage.py db upgrade INFO [alembic.migration] Context impl SQLiteImpl. INFO [alembic.migration] Will assume non-transactional DDL. (venv) F:\flask\flask1>python manage.py shell ~~Comment.confirmed sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x000000000436BB70> 求帮忙,自学中……(:哭
新手求指导python flask开发web项目经验
大一快结束 参与一个正式的项目,运用python flask框架进行web开发。以前学过c,c++,会写代码。但是学完python,入门了flask框架后,也会写代码,不明白如何在项目里写代码,是我没理解到python的内涵么,还是其他什么原因(求推荐一些开源web开发项目代码学习一下)
部署flask项目到heroku上时,出现psycopg2.errors.UndefinedTable: relation "question" does not exist问题,该怎么解决?
当我把flask项目部署到heroku上后,打开app时显示**Internal Server Error**. 报错为 ``` psycopg2.errors.UndefinedTable: relation "question" does not exist ``` 我google下,可能是由于migrations文件导致的,于是我就把该文件删掉了。但依然出现同样的问题。 求大神帮忙,现在踩在坑里有点出不去了。 这是我的config.py文件: ``` import os DEBUG = True SECRET_KEY = os.urandom(24) MAX_CONTENT_LENGTH = 1 * 1024 * 1024 SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') SQLALCHEMY_TRACK_MODIFICATIONS=False ``` 下面是heroku 的logs: ``` 2019-11-17T08:43:29.637889+00:00 app[web.1]: [2019-11-17 08:43:29 +0000] [11] [ERROR] Error handling request / 2019-11-17T08:43:29.637935+00:00 app[web.1]: Traceback (most recent call last): 2019-11-17T08:43:29.637940+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1249, in _execute_context 2019-11-17T08:43:29.637942+00:00 app[web.1]: cursor, statement, parameters, context 2019-11-17T08:43:29.637945+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 580, in do_execute 2019-11-17T08:43:29.637947+00:00 app[web.1]: cursor.execute(statement, parameters) 2019-11-17T08:43:29.637949+00:00 app[web.1]: psycopg2.errors.UndefinedTable: relation "question" does not exist 2019-11-17T08:43:29.637952+00:00 app[web.1]: LINE 2: FROM question ORDER BY question.create_time DESC 2019-11-17T08:43:29.637955+00:00 app[web.1]: ^ 2019-11-17T08:43:29.637956+00:00 app[web.1]: 2019-11-17T08:43:29.637958+00:00 app[web.1]: 2019-11-17T08:43:29.637960+00:00 app[web.1]: The above exception was the direct cause of the following exception: 2019-11-17T08:43:29.637962+00:00 app[web.1]: 2019-11-17T08:43:29.637964+00:00 app[web.1]: Traceback (most recent call last): 2019-11-17T08:43:29.637966+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 134, in handle 2019-11-17T08:43:29.637968+00:00 app[web.1]: self.handle_request(listener, req, client, addr) 2019-11-17T08:43:29.637970+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 175, in handle_request 2019-11-17T08:43:29.637972+00:00 app[web.1]: respiter = self.wsgi(environ, resp.start_response) 2019-11-17T08:43:29.637984+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 2463, in __call__ 2019-11-17T08:43:29.637986+00:00 app[web.1]: return self.wsgi_app(environ, start_response) 2019-11-17T08:43:29.637988+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 2449, in wsgi_app 2019-11-17T08:43:29.637990+00:00 app[web.1]: response = self.handle_exception(e) 2019-11-17T08:43:29.637992+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1866, in handle_exception 2019-11-17T08:43:29.637993+00:00 app[web.1]: reraise(exc_type, exc_value, tb) 2019-11-17T08:43:29.637995+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise 2019-11-17T08:43:29.637997+00:00 app[web.1]: raise value 2019-11-17T08:43:29.637999+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app 2019-11-17T08:43:29.638000+00:00 app[web.1]: response = self.full_dispatch_request() 2019-11-17T08:43:29.638002+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request 2019-11-17T08:43:29.638004+00:00 app[web.1]: rv = self.handle_user_exception(e) 2019-11-17T08:43:29.638006+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception 2019-11-17T08:43:29.638008+00:00 app[web.1]: reraise(exc_type, exc_value, tb) 2019-11-17T08:43:29.638010+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise 2019-11-17T08:43:29.638011+00:00 app[web.1]: raise value 2019-11-17T08:43:29.638013+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request 2019-11-17T08:43:29.638015+00:00 app[web.1]: rv = self.dispatch_request() 2019-11-17T08:43:29.638017+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request 2019-11-17T08:43:29.638019+00:00 app[web.1]: return self.view_functions[rule.endpoint](**req.view_args) 2019-11-17T08:43:29.638021+00:00 app[web.1]: File "/app/project.py", line 27, in index 2019-11-17T08:43:29.638023+00:00 app[web.1]: 'questions': Questions.query.order_by(desc('create_time')).all() 2019-11-17T08:43:29.638025+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3186, in all 2019-11-17T08:43:29.638027+00:00 app[web.1]: return list(self) 2019-11-17T08:43:29.638029+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3342, in __iter__ 2019-11-17T08:43:29.638031+00:00 app[web.1]: return self._execute_and_instances(context) 2019-11-17T08:43:29.638033+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3367, in _execute_and_instances 2019-11-17T08:43:29.638035+00:00 app[web.1]: result = conn.execute(querycontext.statement, self._params) 2019-11-17T08:43:29.638037+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 988, in execute 2019-11-17T08:43:29.638039+00:00 app[web.1]: return meth(self, multiparams, params) 2019-11-17T08:43:29.638041+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/sql/elements.py", line 287, in _execute_on_connection 2019-11-17T08:43:29.638043+00:00 app[web.1]: return connection._execute_clauseelement(self, multiparams, params) 2019-11-17T08:43:29.638045+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1107, in _execute_clauseelement 2019-11-17T08:43:29.638047+00:00 app[web.1]: distilled_params, 2019-11-17T08:43:29.638049+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1253, in _execute_context 2019-11-17T08:43:29.638051+00:00 app[web.1]: e, statement, parameters, cursor, context 2019-11-17T08:43:29.638053+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1473, in _handle_dbapi_exception 2019-11-17T08:43:29.638055+00:00 app[web.1]: util.raise_from_cause(sqlalchemy_exception, exc_info) 2019-11-17T08:43:29.638057+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 398, in raise_from_cause 2019-11-17T08:43:29.638059+00:00 app[web.1]: reraise(type(exception), exception, tb=exc_tb, cause=cause) 2019-11-17T08:43:29.638061+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 152, in reraise 2019-11-17T08:43:29.638063+00:00 app[web.1]: raise value.with_traceback(tb) 2019-11-17T08:43:29.638076+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1249, in _execute_context 2019-11-17T08:43:29.638079+00:00 app[web.1]: cursor, statement, parameters, context 2019-11-17T08:43:29.638081+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 580, in do_execute 2019-11-17T08:43:29.638083+00:00 app[web.1]: cursor.execute(statement, parameters) 2019-11-17T08:43:29.638085+00:00 app[web.1]: sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "question" does not exist 2019-11-17T08:43:29.638087+00:00 app[web.1]: LINE 2: FROM question ORDER BY question.create_time DESC 2019-11-17T08:43:29.638089+00:00 app[web.1]: ^ 2019-11-17T08:43:29.638091+00:00 app[web.1]: 2019-11-17T08:43:29.638095+00:00 app[web.1]: [SQL: SELECT question.id AS question_id, question.title AS question_title, question.content AS question_content, question.create_time AS question_create_time, question.author_id AS question_author_id 2019-11-17T08:43:29.638097+00:00 app[web.1]: FROM question ORDER BY question.create_time DESC] 2019-11-17T08:43:29.638099+00:00 app[web.1]: (Background on this error at: http://sqlalche.me/e/f405) 2019-11-17T08:43:29.638285+00:00 app[web.1]: 10.61.164.89 - - [17/Nov/2019:08:43:29 +0000] "GET / HTTP/1.1" 500 0 "-" "-" 2019-11-17T08:44:42.918911+00:00 app[web.1]: [2019-11-17 08:44:42 +0000] [11] [ERROR] Error handling request / 2019-11-17T08:44:42.918940+00:00 app[web.1]: Traceback (most recent call last): 2019-11-17T08:44:42.918944+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1249, in _execute_context 2019-11-17T08:44:42.918946+00:00 app[web.1]: cursor, statement, parameters, context 2019-11-17T08:44:42.918948+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 580, in do_execute 2019-11-17T08:44:42.918950+00:00 app[web.1]: cursor.execute(statement, parameters) 2019-11-17T08:44:42.918952+00:00 app[web.1]: psycopg2.errors.UndefinedTable: relation "question" does not exist 2019-11-17T08:44:42.918955+00:00 app[web.1]: LINE 2: FROM question ORDER BY question.create_time DESC 2019-11-17T08:44:42.918957+00:00 app[web.1]: ^ 2019-11-17T08:44:42.918959+00:00 app[web.1]: 2019-11-17T08:44:42.918961+00:00 app[web.1]: 2019-11-17T08:44:42.918963+00:00 app[web.1]: The above exception was the direct cause of the following exception: 2019-11-17T08:44:42.918965+00:00 app[web.1]: 2019-11-17T08:44:42.918967+00:00 app[web.1]: Traceback (most recent call last): 2019-11-17T08:44:42.918969+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 134, in handle 2019-11-17T08:44:42.918971+00:00 app[web.1]: self.handle_request(listener, req, client, addr) 2019-11-17T08:44:42.918973+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 175, in handle_request 2019-11-17T08:44:42.918975+00:00 app[web.1]: respiter = self.wsgi(environ, resp.start_response) 2019-11-17T08:44:42.918977+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 2463, in __call__ 2019-11-17T08:44:42.918979+00:00 app[web.1]: return self.wsgi_app(environ, start_response) 2019-11-17T08:44:42.918981+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 2449, in wsgi_app 2019-11-17T08:44:42.918983+00:00 app[web.1]: response = self.handle_exception(e) 2019-11-17T08:44:42.918985+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1866, in handle_exception 2019-11-17T08:44:42.918988+00:00 app[web.1]: reraise(exc_type, exc_value, tb) 2019-11-17T08:44:42.918989+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise 2019-11-17T08:44:42.918991+00:00 app[web.1]: raise value 2019-11-17T08:44:42.918994+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app 2019-11-17T08:44:42.918996+00:00 app[web.1]: response = self.full_dispatch_request() 2019-11-17T08:44:42.918998+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request 2019-11-17T08:44:42.919000+00:00 app[web.1]: rv = self.handle_user_exception(e) 2019-11-17T08:44:42.919002+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception 2019-11-17T08:44:42.919004+00:00 app[web.1]: reraise(exc_type, exc_value, tb) 2019-11-17T08:44:42.919006+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise 2019-11-17T08:44:42.919008+00:00 app[web.1]: raise value 2019-11-17T08:44:42.919010+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request 2019-11-17T08:44:42.919012+00:00 app[web.1]: rv = self.dispatch_request() 2019-11-17T08:44:42.919014+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request 2019-11-17T08:44:42.919016+00:00 app[web.1]: return self.view_functions[rule.endpoint](**req.view_args) 2019-11-17T08:44:42.919018+00:00 app[web.1]: File "/app/project.py", line 27, in index 2019-11-17T08:44:42.919020+00:00 app[web.1]: 'questions': Questions.query.order_by(desc('create_time')).all() 2019-11-17T08:44:42.919022+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3186, in all 2019-11-17T08:44:42.919025+00:00 app[web.1]: return list(self) 2019-11-17T08:44:42.919027+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3342, in __iter__ 2019-11-17T08:44:42.919028+00:00 app[web.1]: return self._execute_and_instances(context) 2019-11-17T08:44:42.919031+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3367, in _execute_and_instances 2019-11-17T08:44:42.919033+00:00 app[web.1]: result = conn.execute(querycontext.statement, self._params) 2019-11-17T08:44:42.919035+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 988, in execute 2019-11-17T08:44:42.919037+00:00 app[web.1]: return meth(self, multiparams, params) 2019-11-17T08:44:42.919039+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/sql/elements.py", line 287, in _execute_on_connection 2019-11-17T08:44:42.919041+00:00 app[web.1]: return connection._execute_clauseelement(self, multiparams, params) 2019-11-17T08:44:42.919043+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1107, in _execute_clauseelement 2019-11-17T08:44:42.919046+00:00 app[web.1]: distilled_params, 2019-11-17T08:44:42.919048+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1253, in _execute_context 2019-11-17T08:44:42.919050+00:00 app[web.1]: e, statement, parameters, cursor, context 2019-11-17T08:44:42.919052+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1473, in _handle_dbapi_exception 2019-11-17T08:44:42.919054+00:00 app[web.1]: util.raise_from_cause(sqlalchemy_exception, exc_info) 2019-11-17T08:44:42.919056+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 398, in raise_from_cause 2019-11-17T08:44:42.919058+00:00 app[web.1]: reraise(type(exception), exception, tb=exc_tb, cause=cause) 2019-11-17T08:44:42.919060+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 152, in reraise 2019-11-17T08:44:42.919063+00:00 app[web.1]: raise value.with_traceback(tb) 2019-11-17T08:44:42.919074+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1249, in _execute_context 2019-11-17T08:44:42.919077+00:00 app[web.1]: cursor, statement, parameters, context 2019-11-17T08:44:42.919079+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 580, in do_execute 2019-11-17T08:44:42.919081+00:00 app[web.1]: cursor.execute(statement, parameters) 2019-11-17T08:44:42.919083+00:00 app[web.1]: sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "question" does not exist 2019-11-17T08:44:42.919085+00:00 app[web.1]: LINE 2: FROM question ORDER BY question.create_time DESC 2019-11-17T08:44:42.919087+00:00 app[web.1]: ^ 2019-11-17T08:44:42.919088+00:00 app[web.1]: 2019-11-17T08:44:42.919091+00:00 app[web.1]: [SQL: SELECT question.id AS question_id, question.title AS question_title, question.content AS question_content, question.create_time AS question_create_time, question.author_id AS question_author_id 2019-11-17T08:44:42.919094+00:00 app[web.1]: FROM question ORDER BY question.create_time DESC] 2019-11-17T08:44:42.919096+00:00 app[web.1]: (Background on this error at: http://sqlalche.me/e/f405) 2019-11-17T08:44:42.919234+00:00 app[web.1]: 10.5.225.117 - - [17/Nov/2019:08:44:42 +0000] "GET / HTTP/1.1" 500 0 "-" "-" 2019-11-17T08:44:42.918749+00:00 heroku[router]: at=info method=GET path="/" host=tianliang-flask-app.herokuapp.com request_id=c195162e-6529-4fb0-9aac-1d9dd9a450e8 fwd="58.182.174.147" dyno=web.1 connect=1ms service=7ms status=500 bytes=244 protocol=https 2019-11-17T09:02:25.748890+00:00 app[web.1]: [2019-11-17 09:02:25 +0000] [12] [ERROR] Error handling request / 2019-11-17T09:02:25.748917+00:00 app[web.1]: Traceback (most recent call last): 2019-11-17T09:02:25.748921+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1249, in _execute_context 2019-11-17T09:02:25.748923+00:00 app[web.1]: cursor, statement, parameters, context 2019-11-17T09:02:25.748932+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 580, in do_execute 2019-11-17T09:02:25.748934+00:00 app[web.1]: cursor.execute(statement, parameters) 2019-11-17T09:02:25.748936+00:00 app[web.1]: psycopg2.errors.UndefinedTable: relation "question" does not exist 2019-11-17T09:02:25.748939+00:00 app[web.1]: LINE 2: FROM question ORDER BY question.create_time DESC 2019-11-17T09:02:25.748943+00:00 app[web.1]: ^ 2019-11-17T09:02:25.748944+00:00 app[web.1]: 2019-11-17T09:02:25.748947+00:00 app[web.1]: 2019-11-17T09:02:25.748949+00:00 app[web.1]: The above exception was the direct cause of the following exception: 2019-11-17T09:02:25.748950+00:00 app[web.1]: 2019-11-17T09:02:25.748952+00:00 app[web.1]: Traceback (most recent call last): 2019-11-17T09:02:25.748953+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 134, in handle 2019-11-17T09:02:25.748955+00:00 app[web.1]: self.handle_request(listener, req, client, addr) 2019-11-17T09:02:25.748956+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 175, in handle_request 2019-11-17T09:02:25.748958+00:00 app[web.1]: respiter = self.wsgi(environ, resp.start_response) 2019-11-17T09:02:25.748991+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 2463, in __call__ 2019-11-17T09:02:25.748994+00:00 app[web.1]: return self.wsgi_app(environ, start_response) 2019-11-17T09:02:25.748996+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 2449, in wsgi_app 2019-11-17T09:02:25.748998+00:00 app[web.1]: response = self.handle_exception(e) 2019-11-17T09:02:25.749000+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1866, in handle_exception 2019-11-17T09:02:25.749002+00:00 app[web.1]: reraise(exc_type, exc_value, tb) 2019-11-17T09:02:25.749004+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise 2019-11-17T09:02:25.749006+00:00 app[web.1]: raise value 2019-11-17T09:02:25.749008+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app 2019-11-17T09:02:25.749010+00:00 app[web.1]: response = self.full_dispatch_request() 2019-11-17T09:02:25.749012+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request 2019-11-17T09:02:25.749014+00:00 app[web.1]: rv = self.handle_user_exception(e) 2019-11-17T09:02:25.749016+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception 2019-11-17T09:02:25.749018+00:00 app[web.1]: reraise(exc_type, exc_value, tb) 2019-11-17T09:02:25.749020+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise 2019-11-17T09:02:25.749023+00:00 app[web.1]: raise value 2019-11-17T09:02:25.749024+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request 2019-11-17T09:02:25.749026+00:00 app[web.1]: rv = self.dispatch_request() 2019-11-17T09:02:25.749027+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request 2019-11-17T09:02:25.749029+00:00 app[web.1]: return self.view_functions[rule.endpoint](**req.view_args) 2019-11-17T09:02:25.749030+00:00 app[web.1]: File "/app/project.py", line 27, in index 2019-11-17T09:02:25.749032+00:00 app[web.1]: 'questions': Questions.query.order_by(desc('create_time')).all() 2019-11-17T09:02:25.749033+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3186, in all 2019-11-17T09:02:25.749036+00:00 app[web.1]: return list(self) 2019-11-17T09:02:25.749038+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3342, in __iter__ 2019-11-17T09:02:25.749039+00:00 app[web.1]: return self._execute_and_instances(context) 2019-11-17T09:02:25.749041+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3367, in _execute_and_instances 2019-11-17T09:02:25.749042+00:00 app[web.1]: result = conn.execute(querycontext.statement, self._params) 2019-11-17T09:02:25.749044+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 988, in execute 2019-11-17T09:02:25.749045+00:00 app[web.1]: return meth(self, multiparams, params) 2019-11-17T09:02:25.749047+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/sql/elements.py", line 287, in _execute_on_connection 2019-11-17T09:02:25.749048+00:00 app[web.1]: return connection._execute_clauseelement(self, multiparams, params) 2019-11-17T09:02:25.749050+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1107, in _execute_clauseelement 2019-11-17T09:02:25.749051+00:00 app[web.1]: distilled_params, 2019-11-17T09:02:25.749053+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1253, in _execute_context 2019-11-17T09:02:25.749054+00:00 app[web.1]: e, statement, parameters, cursor, context 2019-11-17T09:02:25.749056+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1473, in _handle_dbapi_exception 2019-11-17T09:02:25.749057+00:00 app[web.1]: util.raise_from_cause(sqlalchemy_exception, exc_info) 2019-11-17T09:02:25.749059+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 398, in raise_from_cause 2019-11-17T09:02:25.749060+00:00 app[web.1]: reraise(type(exception), exception, tb=exc_tb, cause=cause) 2019-11-17T09:02:25.749062+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 152, in reraise 2019-11-17T09:02:25.749063+00:00 app[web.1]: raise value.with_traceback(tb) 2019-11-17T09:02:25.749074+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1249, in _execute_context 2019-11-17T09:02:25.749076+00:00 app[web.1]: cursor, statement, parameters, context 2019-11-17T09:02:25.749078+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 580, in do_execute 2019-11-17T09:02:25.749080+00:00 app[web.1]: cursor.execute(statement, parameters) 2019-11-17T09:02:25.749082+00:00 app[web.1]: sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "question" does not exist 2019-11-17T09:02:25.749084+00:00 app[web.1]: LINE 2: FROM question ORDER BY question.create_time DESC 2019-11-17T09:02:25.749087+00:00 app[web.1]: ^ 2019-11-17T09:02:25.749089+00:00 app[web.1]: 2019-11-17T09:02:25.749092+00:00 app[web.1]: [SQL: SELECT question.id AS question_id, question.title AS question_title, question.content AS question_content, question.create_time AS question_create_time, question.author_id AS question_author_id 2019-11-17T09:02:25.749094+00:00 app[web.1]: FROM question ORDER BY question.create_time DESC] 2019-11-17T09:02:25.749096+00:00 app[web.1]: (Background on this error at: http://sqlalche.me/e/f405) 2019-11-17T09:02:25.749271+00:00 app[web.1]: 10.69.244.94 - - [17/Nov/2019:09:02:25 +0000] "GET / HTTP/1.1" 500 0 "-" "-" 2019-11-17T09:02:25.755053+00:00 heroku[router]: at=info method=GET path="/" host=tianliang-flask-app.herokuapp.com request_id=181975e4-7c78-4f7f-b131-4b1ddb544e02 fwd="58.182.174.147" dyno=web.1 connect=0ms service=92ms status=500 bytes=244 protocol=https 2019-11-17T09:06:00.663577+00:00 heroku[router]: at=info method=GET path="/" host=tianliang-flask-app.herokuapp.com request_id=571550f7-554b-42d0-b127-0a4837f6aae9 fwd="58.182.174.147" dyno=web.1 connect=1ms service=17ms status=500 bytes=244 protocol=https 2019-11-17T09:06:00.661593+00:00 app[web.1]: [2019-11-17 09:06:00 +0000] [11] [ERROR] Error handling request / 2019-11-17T09:06:00.661619+00:00 app[web.1]: Traceback (most recent call last): 2019-11-17T09:06:00.662439+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1249, in _execute_context 2019-11-17T09:06:00.662443+00:00 app[web.1]: cursor, statement, parameters, context 2019-11-17T09:06:00.662447+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 580, in do_execute 2019-11-17T09:06:00.662449+00:00 app[web.1]: cursor.execute(statement, parameters) 2019-11-17T09:06:00.662452+00:00 app[web.1]: psycopg2.errors.UndefinedTable: relation "question" does not exist 2019-11-17T09:06:00.662455+00:00 app[web.1]: LINE 2: FROM question ORDER BY question.create_time DESC 2019-11-17T09:06:00.662457+00:00 app[web.1]: ^ 2019-11-17T09:06:00.662459+00:00 app[web.1]: 2019-11-17T09:06:00.662461+00:00 app[web.1]: 2019-11-17T09:06:00.662464+00:00 app[web.1]: The above exception was the direct cause of the following exception: 2019-11-17T09:06:00.662466+00:00 app[web.1]: 2019-11-17T09:06:00.662471+00:00 app[web.1]: Traceback (most recent call last): 2019-11-17T09:06:00.662473+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 134, in handle 2019-11-17T09:06:00.662476+00:00 app[web.1]: self.handle_request(listener, req, client, addr) 2019-11-17T09:06:00.662478+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 175, in handle_request 2019-11-17T09:06:00.662480+00:00 app[web.1]: respiter = self.wsgi(environ, resp.start_response) 2019-11-17T09:06:00.662483+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 2463, in __call__ 2019-11-17T09:06:00.662486+00:00 app[web.1]: return self.wsgi_app(environ, start_response) 2019-11-17T09:06:00.662488+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 2449, in wsgi_app 2019-11-17T09:06:00.662491+00:00 app[web.1]: response = self.handle_exception(e) 2019-11-17T09:06:00.662493+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1866, in handle_exception 2019-11-17T09:06:00.662495+00:00 app[web.1]: reraise(exc_type, exc_value, tb) 2019-11-17T09:06:00.662498+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise 2019-11-17T09:06:00.662500+00:00 app[web.1]: raise value 2019-11-17T09:06:00.662502+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app 2019-11-17T09:06:00.662505+00:00 app[web.1]: response = self.full_dispatch_request() 2019-11-17T09:06:00.662507+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request 2019-11-17T09:06:00.662509+00:00 app[web.1]: rv = self.handle_user_exception(e) 2019-11-17T09:06:00.662511+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception 2019-11-17T09:06:00.662513+00:00 app[web.1]: reraise(exc_type, exc_value, tb) 2019-11-17T09:06:00.662515+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise 2019-11-17T09:06:00.662517+00:00 app[web.1]: raise value 2019-11-17T09:06:00.662519+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request 2019-11-17T09:06:00.662521+00:00 app[web.1]: rv = self.dispatch_request() 2019-11-17T09:06:00.662523+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request 2019-11-17T09:06:00.662526+00:00 app[web.1]: return self.view_functions[rule.endpoint](**req.view_args) 2019-11-17T09:06:00.662528+00:00 app[web.1]: File "/app/project.py", line 27, in index 2019-11-17T09:06:00.662530+00:00 app[web.1]: 'questions': Questions.query.order_by(desc('create_time')).all() 2019-11-17T09:06:00.662532+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3186, in all 2019-11-17T09:06:00.662535+00:00 app[web.1]: return list(self) 2019-11-17T09:06:00.662537+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3342, in __iter__ 2019-11-17T09:06:00.662539+00:00 app[web.1]: return self._execute_and_instances(context) 2019-11-17T09:06:00.662541+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3367, in _execute_and_instances 2019-11-17T09:06:00.662544+00:00 app[web.1]: result = conn.execute(querycontext.statement, self._params) 2019-11-17T09:06:00.662546+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 988, in execute 2019-11-17T09:06:00.662548+00:00 app[web.1]: return meth(self, multiparams, params) 2019-11-17T09:06:00.662550+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/sql/elements.py", line 287, in _execute_on_connection 2019-11-17T09:06:00.662552+00:00 app[web.1]: return connection._execute_clauseelement(self, multiparams, params) 2019-11-17T09:06:00.662555+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1107, in _execute_clauseelement 2019-11-17T09:06:00.662557+00:00 app[web.1]: distilled_params, 2019-11-17T09:06:00.662559+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1253, in _execute_context 2019-11-17T09:06:00.662562+00:00 app[web.1]: e, statement, parameters, cursor, context 2019-11-17T09:06:00.662564+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1473, in _handle_dbapi_exception 2019-11-17T09:06:00.662566+00:00 app[web.1]: util.raise_from_cause(sqlalchemy_exception, exc_info) 2019-11-17T09:06:00.662568+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 398, in raise_from_cause 2019-11-17T09:06:00.662570+00:00 app[web.1]: reraise(type(exception), exception, tb=exc_tb, cause=cause) 2019-11-17T09:06:00.662573+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 152, in reraise 2019-11-17T09:06:00.662575+00:00 app[web.1]: raise value.with_traceback(tb) 2019-11-17T09:06:00.662587+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1249, in _execute_context 2019-11-17T09:06:00.662590+00:00 app[web.1]: cursor, statement, parameters, context 2019-11-17T09:06:00.662592+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 580, in do_execute 2019-11-17T09:06:00.662594+00:00 app[web.1]: cursor.execute(statement, parameters) 2019-11-17T09:06:00.662596+00:00 app[web.1]: sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "question" does not exist 2019-11-17T09:06:00.662599+00:00 app[web.1]: LINE 2: FROM question ORDER BY question.create_time DESC 2019-11-17T09:06:00.662601+00:00 app[web.1]: ^ 2019-11-17T09:06:00.662603+00:00 app[web.1]: 2019-11-17T09:06:00.662607+00:00 app[web.1]: [SQL: SELECT question.id AS question_id, question.title AS question_title, question.content AS question_content, question.create_time AS question_create_time, question.author_id AS question_author_id 2019-11-17T09:06:00.662609+00:00 app[web.1]: FROM question ORDER BY question.create_time DESC] ```
Python的web框架flask中如何使用scrapy
用scrapy做了一个单机爬虫。如果要发布的话则需要搞一个web框架,选择了flask但不知道如何使用,谷歌好久也没找到相关博客,希望有大神解答
python flask在主app.py文件中定义了一个工厂函数create_app(),并且创建列一个app实例,为什么还是会报Failed to find application in module "app"的错误。
python flask在主app.py文件中定义了一个工厂函数create_app(),并且创建列一个app实例,为什么还是会报Failed to find application in module "app"的错误。 工厂函数以及main方法 ``` # --app.py def create_app(): app = Flask(__name__) app.config.from_object(config) return app if __name__ == '__main__': app = create_app() app.run() ``` 为什么还是报错: Error: Failed to find application in module "app". Are you sure it contains a Flask application? Maybe you wrapped it in a WSGI middleware or you are using a factory function.
flask + echarts 实现数据可视化jinja2模板页面报错但是可以运行?
我在使用flask+echarts实现数据可视化的时候使用render_template()传递数据到模板,然后使用'{{ }}'' 接收但是模板报错可是运行是没有问题的控制台也没有任何错误信息 后台代码 ![后台](https://img-ask.csdn.net/upload/201903/20/1553046677_197077.jpg) 前台代码 ![前台](https://img-ask.csdn.net/upload/201903/20/1553046754_611987.jpg)
flask中sqlalchemy中的异常都有哪些?继承的父类异常是什么
需要捕获到异常然后进行处理,不能使用EXCEOTION这个基类,所以需要知道其他的异常类型
python flask_sqlalchemy如何维护一个全局查询结果
在我的webapp中,每个页面都要用到同一个一般不会变化的查询结果,为避免每次访问都需查询一次这个变量,我在views.py中弄了一个全局变量ADMIN_NOTES ``` ADMIN_NOTES=Note.query.filter_by(author_id=ADMIN.id).all() ``` 而当ADMIN_NOTE会发生变化时,如此时管理员又写入了一个新note,则重新查询数据库获得最新的ADMIN_NOTE的值,尽量减少访问数据库的次数 我本想这么实现的(中间部分不重要的代码省略了) ``` #全局变量 ADMIN_NOTES=Note.query.filter_by(author_id=ADMIN.id).all() #写入新note的函数1 @app.route('/new_note',methods=['GET','POST']) def new_note(): global ADMIN_NOTES data=json.loads(request.get_data()) note=Note(title=data['note_title'],upload_time=datetime.utcnow()) db.session.add(note) db.session.commit() #若是管理员写入新note,则重新查询并修改全局变量ADMIN_NOTES if note.author.nickname=='ADMIN': ADMIN_NOTES=Note.query.filter_by(author_id=ADMIN.id).all() KAFENUT_NOTES[0].author.nickname #能正确访问ADMIN_NOTES print(len(ADMIN_NOTES)) #正确访问ADMIN_NOTES resp['success']=True resp['text']='Upload successfully!' resp['url']=url_for('note',note_id=note.id,nickname=note.author.nickname) #浏览器接受到服务器的json之后跳转到,resp[url]所指示的页面,即下面这个页面 return json.dumps(resp) #返回note页面的函数2 @app.route('/<nickname>/note/<note_id>',methods=['GET','POST']) def note(nickname,note_id): global ADMIN_NOTES user=User.query.filter_by(nickname=nickname).first() note=Note.query.filter_by(id=note_id).first() if request.method=='GET': note.view_num+=1 db.session.add(note) db.session.commit() for nnote in ADMIN_NOTES: print(nnote.author.nickname) #出错位置 return render_template('note_page.html',note=note,admin_notes=ADMIN_NOTES) ``` 然而问题也正出在这里,当管理员写入新的note之后(即ADMIN_NOTES这个全局变量发生变化之后)重新查询的语句虽然在函数1中执行了(print出的note数量是写入新note之后的数量,)。但当用户根据函数1返回的json跳转到函数2的时候,函数2内就无法正确访问ADMIN_NOTES,准确来说无法访问nnote.author.nickname,其中author是note表用author_id这个外键连接到user表得到的,错误栈如下 ``` Traceback (most recent call last): File "C:\Users\MSI-1\Anaconda3\lib\site-packages\flask\app.py", line 1997, in __call__ return self.wsgi_app(environ, start_response) File "C:\Users\MSI-1\Anaconda3\lib\site-packages\flask\app.py", line 1985, in wsgi_app response = self.handle_exception(e) File "C:\Users\MSI-1\Anaconda3\lib\site-packages\flask\app.py", line 1540, in handle_exception reraise(exc_type, exc_value, tb) File "C:\Users\MSI-1\Anaconda3\lib\site-packages\flask\_compat.py", line 33, in reraise raise value File "C:\Users\MSI-1\Anaconda3\lib\site-packages\flask\app.py", line 1982, in wsgi_app response = self.full_dispatch_request() File "C:\Users\MSI-1\Anaconda3\lib\site-packages\flask\app.py", line 1614, in full_dispatch_request rv = self.handle_user_exception(e) File "C:\Users\MSI-1\Anaconda3\lib\site-packages\flask\app.py", line 1517, in handle_user_exception reraise(exc_type, exc_value, tb) File "C:\Users\MSI-1\Anaconda3\lib\site-packages\flask\_compat.py", line 33, in reraise raise value File "C:\Users\MSI-1\Anaconda3\lib\site-packages\flask\app.py", line 1612, in full_dispatch_request rv = self.dispatch_request() File "C:\Users\MSI-1\Anaconda3\lib\site-packages\flask\app.py", line 1598, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "E:\vs\python\AwesomeWebApp\AwesomeWebApp\app\views.py", line 232, in note print(nnote.author.nickname) #let author.id be preloaded File "C:\Users\MSI-1\Anaconda3\lib\site-packages\sqlalchemy\orm\attributes.py", line 282, in __get__ return self.impl.get(instance_state(instance), dict_) File "C:\Users\MSI-1\Anaconda3\lib\site-packages\sqlalchemy\orm\attributes.py", line 710, in get value = self.callable_(state, passive) File "C:\Users\MSI-1\Anaconda3\lib\site-packages\sqlalchemy\orm\strategies.py", line 688, in _load_for_state % (orm_util.state_str(state), self.key) sqlalchemy.orm.exc.DetachedInstanceError: Parent instance <Note at 0x26de5f41198> is not bound to a Session; lazy load operation of attribute 'author' cannot proceed (Background on this error at: http://sqlalche.me/e/bhk3) ``` sqlalchemy报出detached错误 sqlalchemy.orm.exc.DetachedInstanceError: Parent instance <Note at 0x26de5f41198> is not bound to a Session; lazy load operation of attribute 'author' cannot proceed (Background on this error at: http://sqlalche.me/e/bhk3) 这该怎么解决?或者还有什么其他方法实现:在我的webapp中,每个页面都要用到同一个一般不会变化的查询结果,为避免每次访问都需查询一次这个一般不会变量,我在views.py中弄了一个全局变量ADMIN_NOTES。而当ADMIN_NOTE会发生变化时,如此时管理员又写入了一个新note,则重新查询数据库获得最新的ADMIN_NOTE的值,尽量减少访问数据库的次数
Flask使用不了服务器80端口
................![整个代码](https://img-ask.csdn.net/upload/202001/07/1578364356_859201.png) ............... ![在本地运行无误](https://img-ask.csdn.net/upload/202001/07/1578364392_153955.png) ...........................![服务器上报错](https://img-ask.csdn.net/upload/202001/07/1578364421_438709.png) 本地测试是没有毛病 但是在服务器上就打不开80口 不知道是哪方面的毛病 80口打不开 ,但是修改成5000就能打开 但是我需要的是80端口
python flask博客问题
![图片说明](https://img-ask.csdn.net/upload/201805/08/1525755939_943913.png) 为甚么我点击文章的删除后,数据库里文件已经删除了,但博客页面上那篇文章还在。 然后我一直刷新,有时文章又有,有时又没有了。 刷新后如下 ![图片说明](https://img-ask.csdn.net/upload/201805/08/1525756168_603516.png) 再几次刷新后: ![图片说明](https://img-ask.csdn.net/upload/201805/08/1525756225_519164.png) index里代码: ![图片说明](https://img-ask.csdn.net/upload/201805/09/1525873493_121205.png)
终于明白阿里百度这样的大公司,为什么面试经常拿ThreadLocal考验求职者了
点击上面↑「爱开发」关注我们每晚10点,捕获技术思考和创业资源洞察什么是ThreadLocalThreadLocal是一个本地线程副本变量工具类,各个线程都拥有一份线程私有的数
win10系统安装教程(U盘PE+UEFI安装)
一、准备工作 u盘,电脑一台,win10原版镜像(msdn官网) 二、下载wepe工具箱  极力推荐微pe(微pe官方下载) 下载64位的win10 pe,使用工具箱制作启动U盘打开软件,   选择安装到U盘(按照操作无需更改) 三、重启进入pe系统   1、关机后,将U盘插入电脑 2、按下电源后,按住F12进入启动项选择(技嘉主板是F12)     选择需要启
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
将代码部署服务器,每日早上定时获取到天气数据,并发送到邮箱。 也可以说是一个小人工智障。 思路可以运用在不同地方,主要介绍的是思路。
Nginx 软件层面加强Nginx性能优化的面试问答和解决方案
Nginx 软件层面加强Nginx性能优化的面试问答和解决方案 去年我去爱卡汽车面试PHP,一轮和二轮面的都不错,在三轮面到Nginx的时候很多问题当时不知道怎么回答,确实没有深入学习过,花了一段时间的学习,终于能解答Nginx高性能优化的问题了,10月24号为了获得程序员勋章,发布了半个优化笔记,浏览到了1000+,受到这个鼓舞,我抽时间在仔细整理下关于Nginx性能优化的问题,我们从软件说起。...
【管理系统课程设计】美少女手把手教你后台管理
【文章后台管理系统】URL设计与建模分析+项目源码+运行界面 栏目管理、文章列表、用户管理、角色管理、权限管理模块(文章最后附有源码) 1. 这是一个什么系统? 1.1 学习后台管理系统的原因 随着时代的变迁,现如今各大云服务平台横空出世,市面上有许多如学生信息系统、图书阅读系统、停车场管理系统等的管理系统,而本人家里就有人在用烟草销售系统,直接在网上完成挑选、购买与提交收货点,方便又快捷。 试想,若没有烟草销售系统,本人家人想要购买烟草,还要独自前往药...
11月19日科技资讯|华为明日发布鸿蒙整体战略;京东宣告全面向技术转型;Kotlin 1.3.60 发布
「极客头条」—— 技术人员的新闻圈! CSDN 的读者朋友们早上好哇,「极客头条」来啦,快来看今天都有哪些值得我们技术人关注的重要新闻吧。扫描上方二维码进入 CSDN App 可以收听御姐萌妹 Style 的人工版音频哟。 一分钟速览新闻点! 6G 专家组成员:速率是 5G 的 10 至 100 倍,预计 2030 年商用 雷军:很多人多次劝我放弃WPS,能坚持下来并不是纯粹的商业决定 ...
C语言魔塔游戏
很早就很想写这个,今天终于写完了。 游戏截图: 编译环境: VS2017 游戏需要一些图片,如果有想要的或者对游戏有什么看法的可以加我的QQ 2985486630 讨论,如果暂时没有回应,可以在博客下方留言,到时候我会看到。 下面我来介绍一下游戏的主要功能和实现方式 首先是玩家的定义,使用结构体,这个名字是可以自己改变的 struct gamerole { char n
化繁为简 - 腾讯计费高一致TDXA的实践之路
导语:腾讯计费是孵化于支撑腾讯内部业务千亿级营收的互联网计费平台,在如此庞大的业务体量下,腾讯计费要支撑业务的快速增长,同时还要保证每笔交易不错账。采用最终一致性或离线补...
Python爬虫爬取淘宝,京东商品信息
小编是一个理科生,不善长说一些废话。简单介绍下原理然后直接上代码。 使用的工具(Python+pycharm2019.3+selenium+xpath+chromedriver)其中要使用pycharm也可以私聊我selenium是一个框架可以通过pip下载 pip install selenium -i https://pypi.tuna.tsinghua.edu.cn/simple/ 
Java学习笔记(七十二)—— Cookie
概述 会话技术: 会话:一次会话中包含多次请求和响应 一次会话:浏览器第一次给服务器发送资源请求,会话建立,直到有一方断开为止 功能:在一次会话的范围内的多次请求间,共享数据 方式: 客户端会话技术:Cookie,把数据存储到客户端 服务器端会话技术:Session,把数据存储到服务器端 Cookie 概念:客户端会话技术,将数据存储到客户端 快速入门: 使用步骤: 创建C
Java工作4年来应聘要16K最后没要,细节如下。。。
前奏: 今天2B哥和大家分享一位前几天面试的一位应聘者,工作4年26岁,统招本科。 以下就是他的简历和面试情况。 基本情况: 专业技能: 1、&nbsp;熟悉Sping了解SpringMVC、SpringBoot、Mybatis等框架、了解SpringCloud微服务 2、&nbsp;熟悉常用项目管理工具:SVN、GIT、MAVEN、Jenkins 3、&nbsp;熟悉Nginx、tomca
2020年,冯唐49岁:我给20、30岁IT职场年轻人的建议
点击“技术领导力”关注∆  每天早上8:30推送 作者| Mr.K   编辑| Emma 来源| 技术领导力(ID:jishulingdaoli) 前天的推文《冯唐:职场人35岁以后,方法论比经验重要》,收到了不少读者的反馈,觉得挺受启发。其实,冯唐写了不少关于职场方面的文章,都挺不错的。可惜大家只记住了“春风十里不如你”、“如何避免成为油腻腻的中年人”等不那么正经的文章。 本文整理了冯
程序员该看的几部电影
##1、骇客帝国(1999) 概念:在线/离线,递归,循环,矩阵等 剧情简介: 不久的将来,网络黑客尼奥对这个看似正常的现实世界产生了怀疑。 他结识了黑客崔妮蒂,并见到了黑客组织的首领墨菲斯。 墨菲斯告诉他,现实世界其实是由一个名叫“母体”的计算机人工智能系统控制,人们就像他们饲养的动物,没有自由和思想,而尼奥就是能够拯救人类的救世主。 可是,救赎之路从来都不会一帆风顺,到底哪里才是真实的世界?
作为一个程序员,CPU的这些硬核知识你必须会!
CPU对每个程序员来说,是个既熟悉又陌生的东西? 如果你只知道CPU是中央处理器的话,那可能对你并没有什么用,那么作为程序员的我们,必须要搞懂的就是CPU这家伙是如何运行的,尤其要搞懂它里面的寄存器是怎么一回事,因为这将让你从底层明白程序的运行机制。 随我一起,来好好认识下CPU这货吧 把CPU掰开来看 对于CPU来说,我们首先就要搞明白它是怎么回事,也就是它的内部构造,当然,CPU那么牛的一个东
@程序员,如何花式构建线程?
作者 |曾建责编 | 郭芮出品 | CSDN(ID:CSDNnews)在项目和业务的开发中,我们难免要经常使用线程来进行业务处理,使用线程可以保证我们的业务在相互处理之间可以保证原子性...
破14亿,Python分析我国存在哪些人口危机!
2020年1月17日,国家统计局发布了2019年国民经济报告,报告中指出我国人口突破14亿。 猪哥的朋友圈被14亿人口刷屏,但是很多人并没有看到我国复杂的人口问题:老龄化、男女比例失衡、生育率下降、人口红利下降等。 今天我们就来分析一下我们国家的人口数据吧! 一、背景 1.人口突破14亿 2020年1月17日,国家统计局发布了 2019年国民经济报告 ,报告中指出:年末中国大陆总人口(包括31个
强烈推荐10本程序员在家读的书
很遗憾,这个鼠年春节注定是刻骨铭心的,新型冠状病毒让每个人的神经都是紧绷的。那些处在武汉的白衣天使们,尤其值得我们的尊敬。而我们这些窝在家里的程序员,能不外出就不外出,就是对社会做出的最大的贡献。 有些读者私下问我,窝了几天,有点颓丧,能否推荐几本书在家里看看。我花了一天的时间,挑选了 10 本我最喜欢的书,你可以挑选感兴趣的来读一读。读书不仅可以平复恐惧的压力,还可以对未来充满希望,毕竟苦难终
Linux自学篇——linux命令英文全称及解释
man: Manual 意思是手册,可以用这个命令查询其他命令的用法。 pwd:Print working directory 显示当前目录 su:Swith user 切换用户,切换到root用户 cd:Change directory 切换目录 ls:List files 列出目录下的文件 ps:Process Status 进程状态 mk
Python实战:抓肺炎疫情实时数据,画2019-nCoV疫情地图
文章目录1. 前言2. 数据下载3. 数据处理4. 数据可视化 1. 前言 今天,群里白垩老师问如何用python画武汉肺炎疫情地图。白垩老师是研究海洋生态与地球生物的学者,国家重点实验室成员,于不惑之年学习python,实为我等学习楷模。先前我并没有关注武汉肺炎的具体数据,也没有画过类似的数据分布图。于是就拿了两个小时,专门研究了一下,遂成此文。 2月6日追记:本文发布后,腾讯的数据源多次变更u
智力题(程序员面试经典)
NO.1  有20瓶药丸,其中19瓶装有1克/粒的药丸,余下一瓶装有1.1克/粒的药丸。给你一台称重精准的天平,怎么找出比较重的那瓶药丸?天平只能用一次。 解法 有时候,严格的限制条件有可能反倒是解题的线索。在这个问题中,限制条件是天平只能用一次。 因为天平只能用一次,我们也得以知道一个有趣的事实:一次必须同时称很多药丸,其实更准确地说,是必须从19瓶拿出药丸进行称重。否则,如果跳过两瓶或更多瓶药
在家远程办公效率低?那你一定要收好这个「在家办公」神器!
相信大家都已经收到国务院延长春节假期的消息,接下来,在家远程办公可能将会持续一段时间。 但是问题来了。远程办公不是人在电脑前就当坐班了,相反,对于沟通效率,文件协作,以及信息安全都有着极高的要求。有着非常多的挑战,比如: 1在异地互相不见面的会议上,如何提高沟通效率? 2文件之间的来往反馈如何做到及时性?如何保证信息安全? 3如何规划安排每天工作,以及如何进行成果验收? ......
作为一个程序员,内存和磁盘的这些事情,你不得不知道啊!!!
截止目前,我已经分享了如下几篇文章: 一个程序在计算机中是如何运行的?超级干货!!! 作为一个程序员,CPU的这些硬核知识你必须会! 作为一个程序员,内存的这些硬核知识你必须懂! 这些知识可以说是我们之前都不太重视的基础知识,可能大家在上大学的时候都学习过了,但是嘞,当时由于老师讲解的没那么有趣,又加上这些知识本身就比较枯燥,所以嘞,大家当初几乎等于没学。 再说啦,学习这些,也看不出来有什么用啊!
2020年的1月,我辞掉了我的第一份工作
其实,这篇文章,我应该早点写的,毕竟现在已经2月份了。不过一些其它原因,或者是我的惰性、还有一些迷茫的念头,让自己迟迟没有试着写一点东西,记录下,或者说是总结下自己前3年的工作上的经历、学习的过程。 我自己知道的,在写自己的博客方面,我的文笔很一般,非技术类的文章不想去写;另外我又是一个还比较热衷于技术的人,而平常复杂一点的东西,如果想写文章写的清楚点,是需要足够...
别低估自己的直觉,也别高估自己的智商
所有群全部吵翻天,朋友圈全部沦陷,公众号疯狂转发。这两周没怎么发原创,只发新闻,可能有人注意到了。我不是懒,是文章写了却没发,因为大家的关注力始终在这次的疫情上面,发了也没人看。当然,我...
Java坑人面试题系列: 包装类(中级难度)
Java Magazine上面有一个专门坑人的面试题系列: https://blogs.oracle.com/javamagazine/quiz-2。 这些问题的设计宗旨,主要是测试面试者对Java语言的了解程度,而不是为了用弯弯绕绕的手段把面试者搞蒙。 如果你看过往期的问题,就会发现每一个都不简单。 这些试题模拟了认证考试中的一些难题。 而 “中级(intermediate)” 和 “高级(ad
Spring Boot 2.x基础教程:使用JdbcTemplate访问MySQL数据库
在第2章节中,我们介绍了如何通过Spring Boot来实现HTTP接口,以及围绕HTTP接口相关的单元测试、文档生成等实用技能。但是,这些内容还不足以帮助我们构建一个动态应用的服务端程序。不论我们是要做App、小程序、还是传统的Web站点,对于用户的信息、相关业务的内容,通常都需要对其进行存储,而不是像第2章节中那样,把用户信息存储在内存中(重启就丢了!)。 对于信息的存储,现在已经有非常非常多...
基于Python的人脸自动戴口罩系统
目录 1、项目背景 2、页面设计 3、器官识别 4、退出系统 1、项目背景 2019年新型冠状病毒感染的肺炎疫情发生以来,牵动人心,举国哀痛,口罩、酒精、消毒液奇货可居。 抢不到口罩,怎么办?作为技术人今天分享如何使用Python实现自动戴口罩系统,来安慰自己,系统效果如下所示: 本系统的实现原理是借助 Dlib模块的Landmark人脸68个关键点检测库轻松识别出人脸五官
这个世界上人真的分三六九等,你信吗?
偶然间,在知乎上看到一个问题 一时间,勾起了我深深的回忆。 以前在厂里打过两次工,做过家教,干过辅导班,做过中介。零下几度的晚上,贴过广告,满脸、满手地长冻疮。   再回首那段岁月,虽然苦,但让我学会了坚持和忍耐。让我明白了,在这个世界上,无论环境多么的恶劣,只要心存希望,星星之火,亦可燎原。   下文是原回答,希望能对你能有所启发。   如果我说,这个世界上人真的分三六九等,
相关热词 c# 时间比天数 c# oracle查询 c# 主动推送 事件 c# java 属性 c# 控制台 窗体 c# 静态类存值 c#矢量作图 c#窗体调用外部程式 c# enum是否合法 c# 如何卸载引用
立即提问