Using Django with the Drizzle database? - django

Has anyone experience in using Django with the Drizzle database?
The first GA version of Drizzle has just been released and from my understanding it should be be a good match for Django. Being a stripped down version of MySQL it still provides all the needed functionality and hopefully a better performance.

To use the Django MySQL backend, you have to install the MySQLdb driver. When I install MySQLdb on a machine that has Drizzle installed (but not MySQL), I get this error: EnvironmentError: mysql_config not found. I believe this is the step where MySQLdb is looking for compiler options to build the client. We probably need a fork of the Django MySQL backend that uses a Python wrapper around libdrizzle.

MySQLdb is playing just fine with Drizzle. We use it to work with SQLAlchemy.
I can't speak to the issues you encountered, but I also tend to have both MySQL and Drizzle on my machines. Things built ok for me, but I'd be happy to help resolve any issues anyone else is having

Related

Connect to Sybase database from Django

I tried to connect to Sybase database from Django using sqlanydjango, but
I have stuck. One answer saying that
sqlany-django is no longer maintained; it was last updated in May 2016.
What is the other possibility to connect to Sybase database?
OS Ubuntu 18.04
django 2.2.4
Sybase is no longer maintained and it's not supported by Django. I recommend using one of the supported databases:
PostgreSQL
MariaDB
MySQL
Oracle
SQLite
Personally, I would recommend using PostgreSQL - I think it's the most advanced database. If you use it, I would recommend using version 13, since version 14 is still new and I think it's not officially supported by Django yet. It's always a good practice to use the previous major release. Also with Django, I recommend upgrading to the latest major release only about 4 to 6 months after its initial release. So for today, this means using Django 3.2 (latest minor release, currently 3.2.11).
You can use django-environ to define the database you are using in settings.
You could use the freetds module. GitHub repository was active 5 days ago, it aims to provide support for sybase and MSQL Server.
I used it with MSQL
You can download it from there, and installing with the instruction on this link (Sybase python module website)
Then you can test your installation using these steps
You can also try different Django version.
If this doesn't show anything wrong, and Django still won't connect to your DB, you can try to edit Django's source files so the ImproperlyConfigured exception doesn't raise (REALLY REALLY RISKY, DO A BACK UP OF YOUR DB) or migrate your Sybase to a supported database.
You can use pyodbc.
To install this.
Pip install pyodbc
import pyodbc
cnxn = pyodbc.connect(‘DRIVER={Devart ODBC Driver for ASE};Server=myserver;Port=myport;Database=mydatabase;User ID=myuserid;Password=mypassword;String Types=Unicode’)
For reference:-
https://medium.com/#sharma.jayant1992/best-way-to-connect-python-with-sybase-database-76445713efaf

Error with django-registration module: AppRegistryNotReady("Models aren't loaded yet.")

I am having a problem getting the Django registration module to work. I am relatively new to Django, having only worked through a few examples, now wanting to rebuild a site using user registration, that I've previously made with python.
I am using Python 2.7, Django 1.7.1, and my operating system is Ubuntu 14.04. I'm also using Eclipse/PyDev for my IDE.
I keep getting the error message:
raise AppRegistryNotReady("Models aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.
I have installed both the django-registration and django-registration-redux modules, understanding that there may issues with installing django-registration in Django 1.7. Should I copy the registration module directly into my app, although not advised, but for troubleshooting? Should I uninstall something before I install a new package?
The django-registration module resides in "/usr/local/lib/python2.7/dist-packages." I'm not sure where the django-registration-redux module should have ended up at, although it deposited "django_registration_redux-1.1.egg-info" with the dist-packages.
I have added 'registration', to the settings file, and to my urls' file pattern I've added: (r'^accounts/', include('registration.backends.default.urls')),
I've read numerous on-line postings about this issue, but I can't get around this block. Should I uninstall Django 1.7.1, and install Django 1.6 to avoid this impasse?
Thanks,
Walter Goedecke
Have you considered using django-allauth instead of django-registration?
As I understand it, django-registration is no longer being maintained.
Were you able to resolve this?
When you say “I have installed both the django-registration and django-registration-redux modules”, do you mean you are trying to use both at the same time, or you tried one and then the other? You should only be using django-registration-redux, I believe django-registration stopped being maintained during one of the Django 1.6 releases, maybe it was 1.5 don’t recall. If its of any help, we have Django 1.7.9, Django 1.8.1, and Django 1.8.3 working with django-registration-redux 1.1.
It sounds like you are installing your python packages system wide (you said its residing in /usr/local/lib/python2.7/dist-packages). There is a great tool called virtualenv that lets you keep all of your projects isolated, in their own virtual environment with their unique dependences. This way one project can be using django 1.5 while another is using django 1.7, one project can use django-registration-redux while the other uses allauth, etc. The other great thing about it, is that it makes your projects more portable, easier to share, and easier to update.
If you haven’t tried it yet, you should check it out!
http://docs.python-guide.org/en/latest/dev/virtualenvs/
I found this link very helpful when I was first getting started with Python and Django development:
http://www.jeffknupp.com/blog/2013/12/18/starting-a-django-16-project-the-right-way/

Django and Connector/Python Integration

How can I setup a Django 1.5.1 app running with Python 3.3 to access a MySQL database? I tried using MySQLdb but apparently it doesn't support Python 3.3.
My next intention was to use Connector/Python, but what am I supposed to put for the "Engine" key of the Databases dictionary of the settings.py file?
If someone could provide detailed steps of how to get Django to work with Connector/Python, that would be great!
MySQLdb is the Python interface to MySQL [supported by django]. Version 1.2.1p2 or later is required for full MySQL support in Django.
At the time of writing, the latest release of MySQLdb (1.2.4) doesn’t support Python 3. In order to use MySQL under Python 3, you’ll have to install an unofficial fork, such as MySQL-for-Python-3.
This port is still in alpha. In particular, it doesn’t support binary data, making it impossible to use django.db.models.BinaryField.
Basically your only options to avoid Alpha quality drivers are:
Don't use python 3.
Don't use MySQL.
Hopefully this makes the choice easier: http://grimoire.ca/mysql/choose-something-else
REF: https://docs.djangoproject.com/en/dev/ref/databases/#python-3

Django on Mac OS X requires install of MySQLdb

I tried setting up Django to use a MySQL database and it choked because the backend was not available. Reading around the net I see that MySQLdb needs to be installed, and perhaps _mysql needs to be installed as well. I have been surprised that so many different sets of instructions are available, which all seem to do different things in the install process. There are also a large number of posts about the problems with installing MySQLdb, and frequent comments about the install being a PIA. This gives me pause, as I imagine that arbitrary choices which I may make may cause random and hard to track down bugs.
Is there a consensus on what the most reliable install method is?
I don't mind configuration issues. I'm just hoping not to create original problems. As a general rant, with MySQL being so common of a DBMS, why isn't the backend already installed in Django?
I use Homebrew to install stuff like MySQL. It's pretty simple:
Install Homebrew:
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
Install MySQL using Homebrew:
brew install mysql
Install the MySQL Python module using your preferred Python installation mechanism (I prefer using Pip):
pip install MySQL-python
As a general rant, with MySQL being so common of a DBMS, why isn't the backend already installed in Django?
You can use other database backends with Django (SQLite or PostgreSQL, for example), and the MySQL connector itself is a module installed outside of Django (and potentially used by other software -- it many cases it might already be installed).

Django/Jython ImproperlyConfigured error

As specified in the tutorial (http://www.jython.org/jythonbook/en/1.0/JythonDjango.html), I am using doj.backends.zxjdbc.postgresql as Django's DB engine. However, when I do
jython manage.py syncdb
I get an ImproperlyConfigured error, stating that doj.backends.zxjdbc.postgresql is not an available backend and that no module named postgresql exists. Strangely, if I enter the Jython shell, I can do
import doj.backends.zxjdbc.postgresql
without any error messages.
Ideas on what is going on here?
Solution: django-jython is out of date. 1.4 is not currently supported, so there is no solution to this issue other than to revert to a supported version of django.
Unfortunately it seems like django-jython is not seeing much/any active development anymore...
However, I have found that development versions available at the Google code repository below do work in Django 1.5 (and I assume they may work with 1.4 too, if you pick the right version):
https://code.google.com/p/django-jython/source/list
In particular, I have found that this dev version works with Django 1.5:
https://code.google.com/p/django-jython/source/detail?r=c4a0dd949a6d86a4baf8d1bed3b1926fa5318e87