所以我使用这个名为Folium的酷插件来创建地图.地图被创建为.html,每次更新地图时都会重新生成html.因此,为了在同一页面上显示地图和我的导航栏以及其他内容,我认为我需要将map.html放在iframe笼子里,它可以随意刷新.
因此创建了地图:
map1 = folium.Map(location=[45.5, -73.61], width="100%", height="100%")
map1.save('./maps/map.html')
Run Code Online (Sandbox Code Playgroud)
我已经尝试过iframeing它:
<iframe src="/maps/map.html"></iframe>
Run Code Online (Sandbox Code Playgroud)
但我明白了 404 error
有人昨天建议我为它构建一个端点,如下所示:
@app.route('/http://127.0.0.1:4995/maps/map')
def show_map():
return flask.send_file('/maps/map.html')
Run Code Online (Sandbox Code Playgroud)
但我一直收到404错误
我现在经常玩Folium,拥有在Python中这么容易使用的东西真的很棒。但据我了解,他们的文档严重落后。所以我有两个问题。
map.simple_marker(each_coord, popup=v[0], marker_color='#FFFF00')
map.simple_marker(each_coord, popup=v[0], marker_color='yellow')
map.simple_marker(each_coord, popup=v[0], marker_color='Yellow')
他们都应将标记设为黄色,但默认情况下保持红色。我实际上可以更改为的唯一颜色是红色,绿色和紫色。在folium文档的一个示例中,看起来我们应该能够使用html颜色代码:
folium.CircleMarker([45.5215, -122.6261],
radius=500,
popup='Laurelhurst Park',
color='#3186cc',
fill_color='#3186cc',
).add_to(map_2)
Run Code Online (Sandbox Code Playgroud)
但这对我不起作用。希望有人知道解决这个问题的方法,因为我的项目至少需要12种不同的颜色。
FutureWarning: simple_marker is deprecated. Use add_children(Marker) instead我认为这可能与为什么我无法使颜色起作用有关。但是它们在有关如何使用的任何文档或公开讨论中都没有。add_children也许有知识的人可以澄清?谢谢
我从他们的网站复制粘贴了烧瓶的“hello world”应用程序,并试图运行它。我在 Chrome 中收到一条错误消息说
Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
Run Code Online (Sandbox Code Playgroud)
这是直接来自烧瓶网站的“hello world”应用程序
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
if __name__ == '__main__':
app.debug = True
app.run()
Run Code Online (Sandbox Code Playgroud)
我尝试过的:
- 暂时禁用 Avast!
- 禁用 Windows 防火墙
-确保安装了flask模块
这实际上在几天前有效......
我的应用程序运行良好但后来我改变了一些东西,现在它有时可以"回想"超过30秒然后再回到我身边.问题是Gunicorn在30秒后超时:
[2016-03-28 18:25:52 +0000] [3] [CRITICAL] WORKER TIMEOUT (pid:8)
2016-03-28T18:25:52.625220+00:00 app[web.1]:
[2016-03-28 18:25:52 +0000] [8] [INFO] Worker exiting (pid: 8)
Run Code Online (Sandbox Code Playgroud)
现在,我做了一些研究,我知道我需要为Gunicorn创建一个配置文件并发出命令来覆盖Gunicorn的超时默认值,如下所示:
TIMEOUT=120
但是我该怎么做?我的意思是,我如何告诉Gunicorn,例如,gunicorn_config.txt并尊重我在那里制定的法律?