[英]Change Django Database : SQLITE3 to MARIADB
I am new to Django and python.我是 Django 和 python 的新手。 I made a project on Django with the default database which is sqlite3.我在 Django 上做了一个项目,默认数据库是 sqlite3。 I want to now transfer the database from sqlite3 to Mariadb.我现在想将数据库从 sqlite3 转移到 Mariadb。
There is no data which is present in current sqlite3.当前 sqlite3 中没有数据。 I just want to know how can I transfer the default database.我只想知道如何传输默认数据库。
I have followed the following documentation :我已遵循以下文档:
And added, this to my settings.py:并将其添加到我的 settings.py 中:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'Techdevio',
'USER': 'satharkar',
'PASSWORD': 'root',
'HOST': 'localhost',
'PORT': '',
}
}
I am not sure, how things will work with this now.我不确定,现在情况如何。 I am looking if someone can help me with this.我正在寻找是否有人可以帮助我。 So what I did is by now:所以我现在所做的是:
python manage.py makemigrations
but it is throwing error that mysql client is not installed.尝试运行python manage.py makemigrations
但未安装 mysql 客户端会引发错误。I have followed the documentation and installed everything mentioned their.我已经按照文档安装并安装了他们提到的所有内容。 How will things work after this?在这之后事情将如何运作? So whenever I will try to submit the form in my django project, database, table will be created and data will be then stored under the mariadb?因此,每当我尝试在我的 django 项目中提交表单时,将创建数据库、表并将数据存储在 mariadb 下?
I am new to all this, looking for a resolution in this case or any suggestions on how to proceed with this situation.我对这一切都很陌生,正在寻找这种情况下的解决方案或有关如何处理这种情况的任何建议。
Thanks谢谢
Django doesn't come with mysqlclient
and hence you may need to install it by Django 不附带mysqlclient
,因此您可能需要通过以下方式安装它
pip install mysqlclient
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.