Python's Django could not connect to Oracle 11g - django

I am a newbie to Python trying out to quickly build a site using Django.
Following are the steps I have performed (Win 7):
Installed Python 2.7
Installed Django 1.4
Created a project and app
Started the server using 'python manage.py startserver' and accessed using the "http://127.0.0.1:8000" the basic page.
Now wanted to configure my Oracle 11g DB for my project. Hence, installed cx_Oracle 5.1-11g and tried 'python manage.py syncdb' which failed with cx_Oracle.DatabaseError: ORA-24315: illegal attribute type.
Got the same error even from a python interpretor.
import cx_Oracle
connection=cx_Oracle.Connection('python_user','python_user','(DESC..string..)')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
cx_Oracle.DatabaseError: ORA-24315: illegal attribute type
I am using the correct credentials and libraries as per my trouble shooting.
Any help is appreciated..

Checking which attribute is failing by raising an explicit exception might help you in the right direction
try:
connection=cx_Oracle.Connection('python_user','python_user','(DESC..string..)')
except cx_Oracle.DatabaseError, e:
print e[0].context
raise

The main problem is versions of the following should be compatible with each other.
Python 2.7, Django 1.4, Oracle DB 11g (which I connect to) and lib cx_Oracle 5.0.3+-11g should be in compatible with Oracle Xe 11.2 (which was 10.2 previously).
After installing the right version and setting the ORACLE_HOME to 'C:/oraclexe/.../11.2.0/server' it started connecting without any issues.

Related

Using google-cloud-tasks with python 2.7 on app-engine

I'm working on migrating a Python 2.7/1st Gen/GAE app to Python 3/2nd Gen/GAE.
My current step is replacing google.appengine.ext.deferred with the Python Client for Cloud Tasks API.
Here is where I'm at:
Still using Python 2.7
Latest updates with gcloud components update
Following the Python Client docs, I added google-cloud-tasks==1.5.0 to my requirements.txt
google-cloud-tasks needs grpcio so I added - name: grpcio\n version: latest to app.yaml
Now dev_appserver.py is giving me the error ImportError: No module named enum
I'm not finding much documentation online so I'm wondering... Is it possible to use google-cloud-tasks with Python 2.7 on app engine?
If so, how do I fix the last error above?

python can load GDAL, but django can't

I was able to successfully install gdal 1.11 and load it from python shell on my windows 32 bit machine. I can also verify its success by typing "gdalinfo --version" and getting the correct version info: GDAL 1.11.4, released 2016/01/25
However, when running "python manage.py shell" in django 1.11, I got error 127 'the specified procedure could not be found'. The error occurred when django called function lgdal = CDLL(lib_path)
I printed out lib_path, it is correct. The same function worked fine in my python shell.
Any idea why loading gdal111.dll would fail in the django environment when it has no problem in the python shell? Thanks.

Django runserver stuck on Performing system checks

I am running python manage.py runserver or migrate and in both commands it is getting stuck on Performing system checks... Can you please help me out to understand what is the issue and how to solve it?
Admins-MacBook-Pro:driveu_backend gathole$ python manage.py runserver
/Users/gathole/.virtualenvs/du/lib/python2.7/site-packages/social_auth/models.py:4: RemovedInDjango19Warning: django.utils.importlib will be removed in Django 1.9.
from django.utils.importlib import import_module
/Users/gathole/.virtualenvs/du/lib/python2.7/site-packages/social_auth/utils.py:14: RemovedInDjango19Warning: The utilities in django.db.models.loading are deprecated in favor of the new application loading system.
from django.db.models.loading import get_model
/Users/gathole/.virtualenvs/du/lib/python2.7/site-packages/social_auth/models.py:4: RemovedInDjango19Warning: django.utils.importlib will be removed in Django 1.9.
from django.utils.importlib import import_module
/Users/gathole/.virtualenvs/du/lib/python2.7/site-packages/social_auth/utils.py:14: RemovedInDjango19Warning: The utilities in django.db.models.loading are deprecated in favor of the new application loading system.
from django.db.models.loading import get_model
Performing system checks...
just try
pip install -U Django
in your virtual environment.
I solve this by upgrade my Django version, without uninstall my MySQL 5.7 Server.
MySQL latest version was causing the issue... Just reverted MySQL version to 5.6 and it worked :)
This is probably a network problem. My code worked fine before but one day I add client = BertClient() in some files and I forgot to start the bert server (bert is an ML model). As a results, I encountered the same problem of starting my Django app.
You can check start from the app's urls.py file by commenting/uncommenting imports.
MySQL 5.7.x on Mac 14.4.0 have the same issue.
1.remove the mysql
2.brew install homebrew/versions/mysql56 (install an older version)

Error while importing cx_Oracle on windows

I am facing a problem while installing cx_Oracle module.
I have installed Oracle Sql developer using which I can connect to any Oracle Server. I have also installed cx_oracle module. Now when I try to import the module I am reciving below mentioned error.
import cx_Oracle
Traceback (most recent call last):
File "", line 1, in
import cx_Oracle
ImportError: DLL load failed: The specified module could not be found.
After googling I can find that they want me to install Oracle client, but since I already have Oracle Sql developer which can act as a oracle client, I am unable to find the difference between two. Can someone please help me out.
You will need C-language based Oracle "client" libraries installed on your local machine. (SQL Developer uses Java libraries). To connect to a remote database you can install the Oracle Instant Client.
I have explained installation steps here for 32 bit OS and here for 64 bit OS.
BTW, you have to add your oracle_instant_client path to your PATH environment variable. The error you've got is because the OS did not load required DLL files for oracle.

Error loading cx_Oracle module with IIS and PyISAPIe

I have developed a Django application, and i am
trying to get it to run under IIS on Windows Server 2003. I'm
generally following the Django walkthrough but my db is Oracle.
If I run python from the command prompt and import cx_Oracle, it works
just fine. If I run the project with django's development server, everything works fine too.
I haven't managed to get it rum on IIS6 but when a test.py is loaded by IIS and
PyISAPIe, it says it cannot load cx_Oracle and displays the following
error:
Error loading cx_Oracle module: DLL load failed: The specified module
could not be found.
I'm using the 32-bit versions of the following:
Python 2.6.6,
PyISAPIe 1.1.0 rc4 py2.6,
Django 1.4.3,
Oracle Client 11.2,
cx_Oracle 5.1 (for Oracle 11g, Python 2.6)
Any thoughts on why this might be happening?
EDIT:I tried downgrading to cx_Oracle 4.4.1 and now I get the error:
ImportError: cannot import name utils