Home > HowTo, Linux > Python 3 Django Mariadb

Python 3 Django Mariadb

December 7th, 2016 Leave a comment Go to comments

Centos 6 x64 Python 3 Django Mariadb
I found out the hard way that python 3 default mysql driver does not work
Anyways You will need to install mariadb devel

vi /etc/yum.conf.d/mariadb.rebo
# CHECK YOUR MARIADB VERSION
rpm -qa |grep maria


[mariadb]
name = MariaDB
# CHECK YOUR MARIADB VERSION rpm -qa |grep maria
baseurl = http://yum.mariadb.org/5.5.47/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

yum install MariaDB-devel.x86_64

test:
/usr/bin/mysql_config

pip install mysqlclient

settings.py

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'django',
'USER': 'django',
'PASSWORD': 'oiasdjoij1oi2j3',
'HOST': '127.0.0.1',
'PORT': '3306',
'OPTIONS': {
'autocommit': True,
},
}
}

(py3.5) [root@monperfcntr01 learn]# python manage.py migrate
System check identified some issues:

WARNINGS:
?: (mysql.W002) MySQL Strict Mode is not set for database connection 'default'
        HINT: MySQL's Strict Mode fixes many data integrity problems in MySQL, such as data truncation upon insertion, by escalating warnings into errors. It is strongly recommended you activate it. See: https://docs.djangoproject.com/en/1.10/ref/databases/#mysql-sql-mode
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying sessions.0001_initial... OK
Categories: HowTo, Linux Tags: , , , ,
  1. No comments yet.
  1. No trackbacks yet.
What is 9 + 7 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)

*