django - django应用的AWS部署
问题描述
我有一个部署在 aws 中的 django 应用程序。ec2 实例中的 URL 也可以正常加载。我的应用程序有一个模式,我应该在其中输入我的团队名称和用户名。每当我尝试[ec2instanceurl]:8000/(当我启动 gunicorn 时)时,我都没有遇到任何警报错误。
但是,当我启动 nginx 并访问没有端口(8000)的 url 时,页面正在加载,每当我在模式中输入详细信息并单击确认按钮时,它都会显示一条警报“[ec2instanceurl] 说错误”
我将在此处附上错误快照
我想知道这是我的 django 应用程序错误还是任何 aws 设置错误。问题是它在当地和gunicorn港口工作得很好。
虽然我是 aws 部署的新手,但我期待建议.. 在此先感谢
nginx 配置文件(/etc/nginx/sites-available)
server {
listen 80;
server_name ec2-34-232-78-132.compute-1.amazonaws.com;
location / {
include proxy_params;
proxy_pass http://unix:/home/ubuntu/rest_project/app.sock;
}
}
gunicorn 配置文件
[program:gunicorn]
directory=/home/ubuntu/rest_project
command=/home/ubuntu/env/bin/gunicorn --workers 3 --bind unix:/home/ubuntu/rest_project/app.sock rest_project.wsgi:application
autostart=true
autorestart=true
stderr_logfile=/var/log/gunicorn/gunicorn.err.log
stdout_logfile=/var/log/gunicorn/gunicorn.out.log
[group:guni]
programs:gunicorn
gunicorn command:
gunicorn --bind 0.0.0.0:8000 rest_project.wsgi:application
解决方案
推荐阅读
- sed - 替换匹配字符串中的子字符串
- sql - 我可以将输入的值以及选定的数据插入到临时表中吗?
- javascript - 无法使用另一个对象数组更新对象数组
- python - 如何从 Python 运行 Word 宏?
- django - Django 将 form_valid 内联表单集上下文传递给 get_context_data()
- python - 使用 SSH 嵌套 For 循环
- c# - 为什么我的屏蔽条目不会更新但其他所有内容都会更新(xamarin.forms.MaskedEntry 控件)
- python - 从 Firebase 存储桶存储下载 CSV 文件 - Python
- reactjs - 如何在 JSP 之上添加 React 工具提示?
- database - @ManyToOne 映射没有中间表的实体