BCS Django Tutorial 01

Python version 3.5.x does not employ the normal MySQL databases.  Eclipse Neon 4.6 supports PyDev plugin for Python and Django.  I recommend using Eclipse for project creations.  When I authored this article initially Python 3.5.x and Eclipse Neon 4.6 were not available.  The screenshot below show the types of project supported by Eclipse.

dje01

To create a new project invoke the command prompt shell and key in the command as depicted below.

jt01

As you can see the jt01 sub directory has been created and contains the new Django project.

If your DBMS is not configured correctly you can use the following example to do so.

jt02

To configure MySQL for Django modify he “settings.py” of your project to reflect the following.

Near the top of the file place these two statements beneath the existing import statement.

import pymysql
pymysql.install_as_MySQLdb()

Move down to the the databases section and include the code below.

DATABASES = {
    'default': {
        'NAME': 'bcswebtools',
        'ENGINE': 'django.db.backends.mysql',
        'USER': 'user',
        'PASSWORD': 'password',
        'OPTIONS': {
          'autocommit': True,
        },
    }
}

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.