1

How can I setup my django application to connect to mysql when using Jython?

SETTINGS.py

DATABASES = {
    'default': {
        'ENGINE': ''django.db.backends.mysql', # should this be: com.ziclix.python.sql?
    }
}
0

1 Answer 1

3

According to the Django docs and django-jython docs, you can install django-jython, and then use 'doj.backends.zxjdbc.mysql' as database backend.

Also, remember to add the JDBC driver to your classpath:

jython -J-classpath path/to/driver.jar manage.py runserver

or

export CLASSPATH="$CLASSPATH:/path/to/driver.jar"
Sign up to request clarification or add additional context in comments.

1 Comment

It worked as soon as I added the class path. jython -J-classpath path/to/mysql-connector-java-5.1.22-bin.jar manage.py runserver can you add that line and I'll take your answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.