【发布时间】:2016-01-27 20:36:57
【问题描述】:
我正在尝试启动一个基本的 FlaskBootstrapSecurity 应用程序开发环境(Ubuntu 服务器)。
- 克隆的 git
- 是否有 pip 安装要求
- 我只用用户 ID 编辑了 config.py(见下文)
- 修改 manage.py 以使用 host='0.0.0.0' 启动服务器。
然后我执行 python manage.py runserver 并显示 Running on http://0.0.0.0:5000/ [in VENV/lib/python3.4/site-packages/werkzeug/_internal.py:87]
在浏览器(笔记本电脑)上,当我尝试 SERVER_NAME:5000 时,我得到一个 404。
我发现它在日志函数中(第 87 行)。但是卡住了……
感谢任何帮助。
我克隆到一个 $HOME/dev 目录,这样......
$HOME/dev/FlashBootstrapSecurity/flask_application
我想使用 Blueprint 插件和安全功能...但发现很难设置...超过 3 天,现在我已经恢复让基本克隆工作...不走运。
myid = 'myid@gmail.com'
mypw = '***'
# CUSTOMIZED FOR myapp - these are inserted into the Config object
myApp_SYS_ADMINS = myid
myApp_MAIL_USERNAME = myid
myApp_MAIL_PASSWORD = mypw
myApp_SECURITY_EMAIL_SENDER = 'Security < '+myid+' >'
### DO NOT TOUCH BELOW
class Config(object):
def __init__(self):
【问题讨论】:
-
我决定采取不同的策略,即。从各个部分构建 FlaskBootstrapSecurity ......所以我合并到一个新树中:TOP/flask-security TOP/flask-script TOP/templates [/security] TOP/static ... ----我已经能够让登录和注册工作......但现在登录后我无法呈现 index.html 在 @app.route('/') 的视图处理程序上出现错误
jinja2.exceptions.TemplateNotFound: index.html... --- return render_template('index .html') -
我们已经确定该应用程序在本地系统上运行时可以正常工作......但从远程浏览器访问时无法正常工作......有什么方法可以测试来自本地和远程服务器的请求吗?
-
已解决。问题出在 /etc/hosts 中的服务器主机名为 127.0.1.1。通过将其更改为 NIC ip 地址,这解决了问题。显然 FlaskBootstrapSecurity 比我见过的任何其他 Flask 应用示例更安全——仍在尝试学习如何构建集成解决方案。
标签: flask flask-login