简体   繁体   English

在AWS EC2和RDS上使用Django

[英]Django on AWS EC2 and RDS

I am trying to deploy django app on AWS by using EC2 and RDS services. 我正在尝试使用EC2和RDS服务在AWS上部署django应用程序。 I have created EC2 and RDS containers. 我已经创建了EC2和RDS容器。

Here is how i try to connect to my database. 这是我尝试连接到数据库的方式。

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'db name',
        'USER': 'my user',
        'PASSWORD': 'my password',
        'HOST': 'awshost',
        'PORT': '3306',
        'OPTIONS': {
            'charset': 'utf8mb4',
        },
    }
}

For name, user, password, host, port I provide details from my RDS instance running. 对于名称,用户,密码,主机,端口,我提供了正在运行的RDS实例的详细信息。 When I do: python manage.py migrate, It says there is no migration to apply. 当我这样做时:python manage.py migration,它说没有要应用的迁移。 If I try to makemigrations, It says no changes detected. 如果我尝试进行迁移,则表示未检测到任何更改。 If I connect to database directly from terminal and list tables: I see one table django_migrations, which is empty. 如果我直接从终端和列表表连接到数据库:我看到一个表django_migrations,该表为空。 How should I migrate my db? 我应该如何迁移数据库?

I know this explanation is quite broad, I will try narrow it down, accordingly. 我知道这个解释很广泛,因此,我将尝试缩小范围。 For now I dont't know what else is important to this issue. 现在,我不知道还有什么对这个问题很重要。

Run makemigrations and specify the app name. 运行makemigrations并指定应用程序名称。 The migrations folder needs to be created.Your app must be included in INSTALLED_APPS first. 需要创建迁移文件夹。您的应用必须首先包含在INSTALLED_APPS中。

./manage.py makemigrations <myapp>

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM