[英]How to open a document present in EC2 server in local machine?
I deployed my Django Project in AWS EC2 server.我在 AWS EC2 服务器中部署了我的 Django 项目。 My website got hosted successfully.
我的网站成功托管。 Iam running a python code on click of a HTML button to open am Excel Sheet.
我正在单击 HTML 按钮运行 python 代码以打开 Excel 工作表。 Python code to open the excel sheet is given below:
打开excel表格的Python代码如下:
import webbrowser导入浏览器
a_website = "C:\\python\\Python38\\result.xlsx" a_website = "C:\\python\\Python38\\result.xlsx"
webbrowser.open_new(a_website) webbrowser.open_new(a_website)
The excel sheet is opening in the EC2 server. Excel 工作表正在 EC2 服务器中打开。 But I need Excel sheet to be displayed in my local machine on which Iam clicking the HTML button on the hosted Website.
但是我需要在我的本地机器上显示 Excel 工作表,我在该机器上单击托管网站上的 HTML 按钮。
How will I open the Excel sheet present on EC2 server in my local machine?如何在我的本地机器上打开 EC2 服务器上的 Excel 工作表?
You'll need to do some more research into handling serving files with a webserver.您需要对使用网络服务器处理服务文件进行更多研究。 Depending on the webserver there's different ways to send files from the server to client.
根据网络服务器的不同,有不同的方法可以将文件从服务器发送到客户端。 For example: Apache allow you to use the xsendfile module.
例如:Apache 允许您使用 xsendfile 模块。 Be sure to set the
Content-Disposition: attachment
header when you serve the file.确保在提供文件时设置
Content-Disposition: attachment
标题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.