简体   繁体   English

如何在 aws ec2 实例上运行现有的 Django 应用程序?

[英]How to run an existing Django application on aws ec2 instance?

I am trying to run a Django application on AWS Ec2 instance.我正在尝试在 AWS Ec2 实例上运行 Django 应用程序。 I've chosen Ubuntu as my platform.我选择了 Ubuntu 作为我的平台。 After cloning the git repository, and creating a virtual environment, I have installed all apps in my requirements.txt.克隆 git 存储库并创建虚拟环境后,我已经在我的 requirements.txt 中安装了所有应用程序。 When I try to the following lines of code python3 manage.py migrate ;当我尝试以下代码python3 manage.py migrate python3 manage.py check ; python3 manage.py check python3 manage.py runserver the following error is coming up. python3 manage.py runserver出现以下错误。

django.db.utils.OperationalError: connection to server at "localhost" (127.0.0.1), port 5432 failed: FATAL: password authentication failed for user "columbus_db" connection to server at "localhost" (127.0.0.1), port 5432 failed: FATAL: password authentication failed for user "columbus_db" django.db.utils.OperationalError:连接到位于“localhost”(127.0.0.1)的服务器,端口 5432 失败:致命:用户“columbus_db”连接到位于“localhost”(127.0.0.1)的服务器,端口 5432 的密码验证失败失败:致命:用户“columbus_db”的密码验证失败

My settings.py file looks like this我的 settings.py 文件看起来像这样

 DATABASES = {
# 'default': {
#     'ENGINE': 'django.db.backends.sqlite3',
#     'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
# }'default': {
    'ENGINE': 'django.db.backends.postgresql_psycopg2',  # Database Engine of PostgreSQL Database
    'NAME': 'columbus_db',  # Database Name
    'USER': 'columbus_db',  # Database has a Root User
    'PASSWORD': 'columbus',  # Database Connection Password
    'HOST': "localhost",  # IP Address for Localhost
}

What can I change in settings.py or Ec2 Instance settings to start the application and see it at Ec2 IP address?我可以在 settings.py 或 Ec2 实例设置中更改什么以启动应用程序并在 Ec2 IP 地址看到它?

You are missing a running database, the app code except it to be PostgreSQL, you have multiple choices:您缺少正在运行的数据库,应用程序代码除了它是 PostgreSQL,您有多种选择:

  • Install and run a local PostgreSQL instance directly in your EC2直接在您的 EC2 中安装并运行本地 PostgreSQL 实例
  • Use Amazon's managed database RDS使用亚马逊的托管数据库 RDS
  • Use Sqlite which is simple to setup and doesn't require more configuration, but your app might required specific PostgreSQL features使用 Sqlite,它易于设置且不需要更多配置,但您的应用可能需要特定的 PostgreSQL 功能

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 AWS EC2 实例上运行空手道 API 自动化脚本? - How to run Karate API automation script on AWS EC2 instance? AWS EC2 实例 Django 项目 - AWS EC2 instance Django project 如何在 AWS EC2 实例中的公共而非私有 IP 地址的端口 3000 上运行应用程序(以便可以在 inte.net 上访问) - How to run application on port 3000 on Public and Not Private IP Address in AWS EC2 Instance (so it can be accessed on the internet) 用于使用现有目标组配置新 EC2 实例的 AWS CF 模板 - AWS CF Template for provisioning new EC2 instance with Existing Targetgroup SSh AWS Ec2实例 - SSh AWS Ec2 instance 如何通过 AWS“应用程序负载均衡器”将 SSL 流量路由到 EC2 实例 - How do I route SSL traffic through an AWS "Application Load Balancer" to an EC2 instance 如何在具有 mysql 数据库和 costum 域的 windows 服务器 ec2 实例上运行 django 应用程序 - How to run django app on windows server ec2 instance with mysql database and costum domain 如何让我的服务器应用程序在 EC2 实例上运行? - How do I make my server application run on an EC2 instance? AWS - 如何从 CloudWatch Alarm 重启或重启 EC2 实例? - AWS - How to reboot or restart EC2 instance from CloudWatch Alarm? 如何创建 AWS EC2 实例共享文件夹 - How to create AWS EC2 instance shared folders
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM