我已使用本指南在 AWS EC2 实例上部署了 Django 应用程序。
一切正常,但当我下载 Excel 文件时出现错误。(Excel是使用opnenpyxl库创建的)。
下载xlsx文件时,应用程序正在返回download.htm文件。一切在开发服务器上都运行良好。
我试过
download标签。<a href="{% url 'download_estimate_excel_file' project.id project.name %}" class="dropdown-item" download> Download Excel </a>。[没用][service] Environment="LANG=ru_RU.UTF-8"到gunicorn.service文件(也在StackOverflow上找到了这个)。[没用]编辑:
Gunicorn 配置的路径:/etc/systemd/system/gunicorn.service
>> GUNICRON CONFIG
[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target
[Service]
User=sammy
Group=www-data
WorkingDirectory=/home/sammy/myprojectdir
ExecStart=/home/sammy/myprojectdir/myprojectenv/bin/gunicorn \
--access-logfile - \
--workers 3 \
--bind unix:/run/gunicorn.sock \
myproject.wsgi:application
Environment="LANG=ru_RU.UTF-8"
[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)
Nginx 配置的路径:/etc/nginx/sites-available/<myproject>
>> NGINX CONFIG
server {
listen 80;
server_name …Run Code Online (Sandbox Code Playgroud) 执行程序时出现以下错误。
它是一个解析上传文件的程序。
当用户尝试上传文档时出现错误
Error: module 'platform' has no attribute 'linux_distribution'
Path: tmp/resume_2020-08-28_10-09-05/Document.pdf
Traceback (most recent call last):
File "/home/adiagarwal/Python-3.8.0/resume_parser_env/lib/python3.8/site-packages/wand/api.py", line 143, in <module>
libraries = load_library()
File "/home/adiagarwal/Python-3.8.0/resume_parser_env/lib/python3.8/site-packages/wand/api.py", line 132, in load_library
raise IOError('cannot find library; tried paths: ' + repr(tried_paths))
OSError: cannot find library; tried paths: []
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/adiagarwal/projects/BackEnd/admin_api.py", line 198, in post
im = page.to_image()
File "/home/adiagarwal/Python-3.8.0/resume_parser_env/lib/python3.8/site-packages/pdfplumber/page.py", line 255, in to_image
from .display import …Run Code Online (Sandbox Code Playgroud) amazon-ec2 ×1
django ×1
gunicorn ×1
neo4j ×1
nginx ×1
python-3.8 ×1
python-3.x ×1
tornado ×1
ubuntu ×1