- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
Python 新手。按照几个教程在 Ubuntu 18.04 上使用 Python 3.6.7、Flask、Gunicorn、NGINX 和 MySQL 来提供应用程序 ( ddworkflow.com )
教程是:
和
我完成了第一个教程,并且能够成功地提供第二个教程中的基本网页。
在虚拟环境中安装所有内容,并且刚刚使用 pip install Flask-mysql
安装了 Flask-mysql。
我的点卡住显示:
Click==7.0
Flask==1.0.2
Flask-MySQL==1.4.0
itsdangerous==1.1.0
Jinja2==2.10
MarkupSafe==1.1.0
PyMySQL==0.9.3
Werkzeug==0.14.1
安装Flask-MySQL
后,我通过尝试“from”命令的以下不同变体(在python提示符下)来测试安装:
从flask.ext.mysql导入MySQL
从flaskext.mysql导入MySQL
从flask_mysql导入MySQL
从flaskext.mysql导入MySQL
1、2 和 3 都会产生 ModuleNotFoundError...
唯一不抛出错误的是 fromflaskext.mysql import MySQL
但是,当我将 from Flaskext.mysql import MySQL
添加到我的 Flask 应用程序文件 (app01.py) 时,我立即收到 502 bad gateway 错误。我的 app01.py 文件是
from flask import Flask, render_template, json, request
#from flaskext.mysql import MySQL #<--comment out or get 502 error
hello = Flask(__name__)
@hello.route("/")
def greeting():
return render_template('index.html')
@hello.route('/showSignUp')
def showSignUp():
return render_template('signup.html')
@hello.route('/signUp',methods=['POST'])
def signUp():
# read the posted values from the UI
_name = request.form['inputName']
_email = request.form['inputEmail']
_password = request.form['inputPassword']
# validate the received values
if _name and _email and _password:
return json.dumps({'html':'<span>All fields good !!</span>'})
else:
return json.dumps({'html':'<span>Enter the required fields</span>'})
if __name__ == "__main__":
hello.run(host='0.0.0.0')
非常感谢任何帮助我消除 502 错误以便我连接到数据库的信息。谢谢。
最佳答案
这可能是 virtualenv 错误,请查看此链接:https://www.pythonanywhere.com/forums/topic/2877/
关于mysql - "from flaskext.mysql import MySQL"导致服务器显示 502 bad gateway,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54817890/
我刚刚在我的电脑上安装了 flaskext 包,当我导入一个表单时出现以下错误... 运行这个... from flaskext.wtf import Form 产生这个错误... Traceback
我正在关注 this Python-Flask Web App 教程: 在第 5 步,它说要安装 Flask-Mysql 然后使用它导入它: 从 flaskext.mysql 导入 MySQL 但是,
我正在尝试使用 Sign in with SteamID来自 Flask 网站的片段。但是,当我尝试运行它时,我得到 ImportError: No module named flaskext.sql
我编写了一个 Python Flask 应用程序,最初使用 MySQLdb 访问 MySQL。后来我出于同样的目的切换到 flaskext.mysql,但是现在当我使用这个模块时,我看不到如何获取字典
Python 新手。按照几个教程在 Ubuntu 18.04 上使用 Python 3.6.7、Flask、Gunicorn、NGINX 和 MySQL 来提供应用程序 ( ddworkflow.co
我正在使用 Flask 框架和 MySQL 数据库连接器。 我做了以下: from flaskext.mysql import MySQL mysql = MySQL() ## app.config
我使用的是Python 2.7.5 我安装了flask-mysql等等...我已经有一些数据库存储过程在工作,但是我在flask_mysql方面遇到了一些问题 每当我运行我的代码时,它都会说: api
我是一名优秀的程序员,十分优秀!