I am trying to connect to oracle 10g XE database from windows but getting following error
Here is my settings for database
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.oracle',
'NAME': 'xe',
'USER': 'xxx',
'PASSWORD': 'xxx',
'HOST': '127.0.0.1',
'PORT': '1527',
}
}
installed libraries
cx-Oracle==6.1
Django==1.11.10
pytz==2018.3
Tried to identify solutions but found nothing related
the problem was cx-Oracle version. unfortunately cx-Oracle 6.1 does not support oracle 10g so downgraded to cx-Oracle 5.3 and connection was established successfully
cx-Oracle==5.3
Related
This message showed after I executed runserver command:
System check identified no issues (0 silenced)
I have referenced this solution, but it didn't work for me(I start my mysql server by the command
"C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld"
).
Here is the background information(the "pip list" command):
(DjangoEnv) D:\pythonproject\DjangoEnv\loginoutonly>pip list
Package Version
Django 2.1.5
mysqlclient 1.3.13
pip 18.1
PyMySQL 0.9.3
pytz 2018.9
setuptools 40.6.3
wheel 0.32.3
Here is the db information in settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'loginoutonly',
'USER': 'root',
'PASSWORD': 'pwd',
'HOST': 'localhost',
'PORT': '3306'
}
}
XAMPP helped me.
XAMPP says that
Port 3306 in use by "Unable to open process"!
I change my MySQL port to 3307 using XAMPP [Config] button.
Then, I change my settings.py code to
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'loginoutonly',
'USER': 'root',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': '3307'
}
}
I also need to test the MySQL WorkBench connection of this newly connected port "3307".
On my windows machine, I have following packages installed in my app.
django: 1.9.9
pyodbc==4.0.3
django-pyodbc-azure==1.10.4.0
In my settings.py file..
DATABASES = {
'default': {
'ENGINE': 'sql_server.pyodbc',
'NAME': os.environ.get('DB_NAME'),
'USER': os.environ.get('DB_USERNAME'),
'PASSWORD': os.environ.get('DB_PASSWORD'),
'HOST': 'tcp:sdohsandbox.database.windows.net',
'PORT': '1433',
'OPTIONS': {
'driver': 'SQL Server Native Client 11.0',
'MARS_Connection': 'True',
},
'CONN_MAX_AGE': 120,
}
}
When I start server I am getting following error..
django.core.exceptions.ImproperlyConfigured: Django 1.9.9 is not supported.
Though I have latest version of pyodbc I am getting error.
Need help.
You have installed a version of django-pyodbc-azure that does not support Django 1.10. The project page on pypi says:
If you want to use it on older versions of Django, specify an appropriate version number (1.9.x.x for Django 1.9) at installation like this:
pip install "django-pyodbc-azure<1.10"
I'm facing problem while connecting mysql database in django. I'm getting error as
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: DLL load failed: %1 is not a valid Win32 application.
I have set database setting as
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'db_name',
'USER': 'user',
'PASSWORD': 'password',
'HOST': 'localhost', # Or an IP Address that your DB is hosted on
'PORT': '3306',
}
}
I don't know where I'm making mistake.
Probably you are using 64bit python/mysql but pip had installed the 32bit mysql-python.
Download the 64bit mysql-python from the link [The link only has support for python 2.7]:
http://www.codegood.com/archives/129
and run the following:
$ pip install path_to_64bit-mysql-python.zip
I'm a Django newby (I started yesterday) and I'm trying to configure the DB. But since I think I'll always be using Django with MySQL I want to set it up. I read the doc and I saw that in order to use MySQL you have to install a module, and so I did. I installed mysqlclient since installing MySQLdb with pip return:
$ pip2 install mysqldb
Could not find a version that satisfies the requirement mysqldb (from versions: )
No matching distribution found for mysqldb
and the Oracle solution isn't working at all (django don't recognize it).
So I entered my credentials, and it look like this in project's settings.py:
DATABASES = {
'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
'ENGINE': 'django.db.backends.mysql',
'NAME': 'dbname_entered_and_tested',
'USER': 'username_entered_and_tested',
'PASSWORD': 'correct_password',
'HOST': 'externale.domain_name_to_db.com',
'PORT': '3306',
}
}
So it returned me
$ python manage.py runserver
... 30 lines of Exceptions ...
django.db.utils.OperationalError: (2026, 'SSL connection error: error:00000001:lib(0):func(0):reason(1)')
So I googled and I found Django AWS RDS MySQL Error: (2026, 'SSL connection error: error:00000001:lib(0):func(0):reason(1)')
So I set my settings to:
DATABASES = {
'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
'ENGINE': 'django.db.backends.mysql',
'NAME': 'dbname_entered_and_tested',
'USER': 'username_entered_and_tested',
'PASSWORD': 'correct_password',
'HOST': 'externale.domain_name_to_db.com',
'PORT': '3306',
'OPTIONS': {
'skip-ssl',
},
}
}
And it returned me
$ python manager.py runserver
... 30 lines of Exceptions ...
ValueError: dictionary update sequence element #0 has length 8; 2 is required
So I managed to generate my own certificats after reading another stackoverflow post, using OpenSSL and the MySQL doc (https://dev.mysql.com/doc/refman/5.6/en/creating-ssl-files-using-openssl.html) and I succeded, but django threw the same:
django.db.utils.OperationalError: (2026, 'SSL connection error: error:00000001:lib(0):func(0):reason(1)')
I already tried connecting with multiple other clients to my db using the same credentials, disabling SSL, enabling SSL, another user account.
I found a solution but it involve downgrading the MySQL version to 5.6.27 (Django server not starting correctly seems to be a mysql issue.) and it won't be a problem... if I only could :C . The MySQL database since to be a pain for a lot of Django users (so much post talking about that out there ...) and I'm just a newbie but I don't want to be discouraged by a simple bug and stop Django :S So, does someone have an answer ?
EDIT: I'm using the latest version of both django, pip and mysqlclient
I have successfully followed the Django 1.4 Tutorial 1-4 (the poll system) and now its running until I deploy it in Apache Webserver 2.2 using Postgres Database. Everytime I access localhost I always have "Internal Server Error" but if I use MySQL as my database everything is ok. What do you think is wrong? Did I miss something to configure in Postgre?
Here is my database connection settings in Mysql(Working) and in Postgre(Not Working), both using Apache2.2 + mod_wsgi.so
//Postgre
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'django_demo1',
'USER': 'postgres',
'PASSWORD': 'mypassword',
'HOST': 'localhost',
'PORT': '',
}
}
//MySQL
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'django_demo1',
'USER': 'root',
'PASSWORD': 'mypassword',
'HOST': 'localhost',
'PORT': '',
}
}
Other INFO:
OS: windows 7, Python: 2.7, Django: 1.4, Postgre 9.1
If you are able to access MySQL but not Postgres, I guess psycopg2 which is the Postgres adapter for python is not installed. Install psycopg2 using pip.
pip install psycopg2
Here is the pypi.