这是我的代码我正在运行服务器,但我无法获取页面index.html 错误是
x = np.random.randn(100)
y = np.random.randn(100)
line = 0.5*np.linspace(-4, 4, 100)
x_line = np.linspace(-4, 4, 100)
fig, ax = plt.subplots(figsize=(8,5))
df = pd.DataFrame({"x": x, "y":y})
#You pass the wanted axis to the ax argument
df.plot(kind='scatter', x='x', y='y',title="Nice title", grid=True,fontsize=10, ax=ax)
ax.plot(line, x_line, zorder=-1)
错误是
app.get('/',function(request,response){
console.log("/");
response.sendFile(__dirname+"/views/index.html");
})
我不认为服务器正在收到 This 127.0.0.1 page can’t be found
No webpage was found for the web address: http://127.0.0.1:5000/home
HTTP ERROR 404
请求。我没有看到get
被叫。
整个代码:
console.log()
答案 0 :(得分:1)
在您的错误中, Formtastic::UnknownInputError in Admin::Users#new
表示您未定义http://127.0.0.1:5000/home is not found
路线。因此,您需要更新/home
路由,如下所示
app.get('/')
答案 1 :(得分:0)
试试这个
app.use('/', routes);
app.use('/users', users);
//add your route to get file
app.get('/',function(request,response){
console.log("/");
response.sendfile('views/index.html', {root: __dirname });
});
请参阅文档正确理解res.sendFile
点击此URL
http://127.0.0.1:5000/
,将您的文件存入browser