【问题标题】:Hosting Angular App in chrome doesnt work [duplicate]在 chrome 中托管 Angular 应用程序不起作用 [重复]
【发布时间】:2015-09-18 06:18:29
【问题描述】:

我正在尝试在我的本地网络中托管一个应用程序,但我遇到了问题。 我是前端技术的新手,我刚刚开始使用 angular-js。

我将设置为 python-flask API,用于为我提供“127.0.0.1:5000/”或“{myip}:5000/”上的数据。

当我以 http://127.0.0.1:8000/app/index.html#/。 但是当我在 http://{mpip}:8000/app/index.html#/ 上启动它时,该应用程序不允许我登录说身份验证失败,仅在 chrome 中。

在我的网络中,包括我在内的任何人都无法登录到使用 ip(我机器的 ip)链接的 chrome 上的链接。

我已经用可用的装饰器处理了 chrome 的跨域问题@http://flask.pocoo.org/snippets/56/

提前感谢您的帮助。

【问题讨论】:

    标签: python angularjs google-chrome flask


    【解决方案1】:

    您需要告诉 flask 在您网络上的所有公共 IP 地址上运行应用程序。

    更新您的 app.run() 调用,读取 app.run("0.0.0.0")

    更多信息在这里(参见“外部可见服务器”部分):http://flask.pocoo.org/docs/0.10/quickstart/

    【讨论】:

    • 不,它不能在 chrome 上工作,除了它已经在 IE 中工作了。
    • 它可能与 CORS 相关。你启用了吗?
    • 我也试过了,没区别。你能告诉我它是如何在IE中没有问题的吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-25
    • 1970-01-01
    • 2014-10-19
    • 2018-04-26
    • 2016-10-13
    • 2014-08-25
    相关资源
    最近更新 更多