Django + Python3.4 + Mysql(MariaDB)

Just hint for future me:

How to install django with mysqld – log
[root@test smm_py]# vim settings.py 
[root@test smm_py]# python manage.py makemigrations
                    import MySQLdb as Database
                    ImportError: No module named 'MySQLdb'
                    django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named 'MySQLdb'
[root@test smm_py]# pip install mysql-python3
                    Collecting mysql-python
                    Downloading MySQL-python-1.2.5.zip (108kB)
                    100% || 110kB 812kB/s 
                    ImportError: No module named 'ConfigParser'
                    ----------------------------------------
                    Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-t64nwwtb/mysql-python
[root@test smm_py]# easy_install mysql-python
                    ImportError: No module named 'ConfigParser'
                    ImportError: No module named 'ConfigParser'
[root@test smm_py]# pip3 install ConfigParser
                    Collecting ConfigParser
                    _KEYCRE = re.compile(ur"%\(([^)]+)\)s")
                    SyntaxError: invalid syntax
                    ----------------------------------------
[root@test smm_py]# pip3.4 install --allow-external mysql-connector-python mysql-connector-python
                    Collecting mysql-connector-python
                    Downloading http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.0.4.zip (277kB)
                    100% || 278kB 3.7MB/s 
                    Successfully built mysql-connector-python
                    Successfully installed mysql-connector-python-2.0.4
[root@test smm_py]# vim /smm_py/settings.py 
                     76 
                     77 DATABASES = {
                     78     'default': {
                     79 'ENGINE': 'django.db.backends.mysql',
[root@test smm_py]# python3 manage.py makemigrations
                    django.core.exceptions.ImproperlyConfigured: 'mysql.connector.django' isn't an available database backend.
                    Try using 'django.db.backends.XXX', where XXX is one of:
                        'base', 'mysql', 'oracle', 'postgresql_psycopg2', 'sqlite3'
                    Error was: cannot import name 'BaseDatabaseFeatures'
[root@test smm_py]# pip install mysqlclient
                    Installing collected packages: mysqlclient
                    Successfully installed mysqlclient-1.3.6
[root@test smm_py]# python3 manage.py makemigrations
                    No changes detected
[root@test smm_py]# python3 manage.py migrate
                    Operations to perform:
                      Synchronize unmigrated apps: staticfiles, messages
                      Apply all migrations: admin, contenttypes, sessions, auth
                    Synchronizing apps without migrations:
                      Creating tables...
                        Running deferred SQL...
                      Installing custom SQL...
                    Running migrations:
                      Rendering model states... DONE
                      Applying contenttypes.0001_initial... OK
                      Applying auth.0001_initial... OK
                      Applying admin.0001_initial... 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 sessions.0001_initial... OK

Using sources:

  • http://www.8host.com/blog/django-prilozhenie-na-mariadb-v-centos-7/
  • http://stackoverflow.com/questions/14087598/python-3-3-importerror-no-module-named-configparser
  • http://stackoverflow.com/questions/27748556/python3-4-cant-install-mysql-python
  • http://geckich.blogspot.com/2012/08/django-djangocoreexceptionsimproperlyco.html
  • MyOwnCommonSence

 

 

About trianglesis

Александр Брюндтзвельт - гений, филантроп, 100 гривен в кармане. Этот блог - "сток" моих мыслей и заметок. Достаточно одного взгляда на него, чтобы понять, что такой же бардак творится у меня в голове. Если вам этот бардак интересен - милости прошу.
Bookmark the permalink.