简体   繁体   English

如何在本地机器上打开 EC2 服务器中存在的文档?

[英]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.

相关问题 如何在 AWS EC2 上运行 Python 代码并将 csv 文件从服务器写入我的本地计算机? - How to run a Python code on AWS EC2 and write a csv file from the server to my local machine? python:如何从EC2实例在本地计算机上运行命令 - python: How to run command on local machine from an EC2 instance Selenium 在 Amazon Ubuntu 服务器(EC2)没有打开某些链接,但在本地机器上工作正常 - Selenium on Amazon Ubuntu Server (EC2) is not opening certain links but works fine on local machine Javascript请求本地服务器而不是ec2服务器 - Javascript request local server not a ec2 server 如何在关闭本地计算机后在AWS EC2上运行流程? - How to make a process run on AWS EC2 even after closing the local machine? 在本地机器上从 ubuntu (AWS EC2) 读取文件? - reading in a file from ubuntu (AWS EC2) on local machine? 从本地机器将 Python 连接到 AWS EC2 上的 kafka - Connect Python to kafka on AWS EC2 from local machine 如何从 EC2 服务器内部进行代理 - How to proxy from inside an EC2 server 如何在EC2服务器上安装Scipy - How to install Scipy on ec2 server 如何访问与本地计算机不同的服务器上存在的 hadoop 文件系统上的文件? - How do I access files on a hadoop file system present on a different server from my local machine?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM