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.
[codesyntax lang=”python”]

import pymysql
pymysql.install_as_MySQLdb()

[/codesyntax]
Move down to the the databases section and include the code below.
[codesyntax lang=”python”]

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

[/codesyntax]
Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

Leave a Reply

Your email address will not be published. Required fields are marked *