mirror of
https://github.com/django/django.git
synced 2025-07-05 18:29:11 +00:00
magic-removal: Fixed #1481 -- Added support for using alternate MySQL Unix sockets. Thanks, Geert Vanderkelen
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2736 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
08c28d9897
commit
2f7c4d5ca9
@ -75,9 +75,12 @@ class DatabaseWrapper(local):
|
|||||||
'user': settings.DATABASE_USER,
|
'user': settings.DATABASE_USER,
|
||||||
'db': settings.DATABASE_NAME,
|
'db': settings.DATABASE_NAME,
|
||||||
'passwd': settings.DATABASE_PASSWORD,
|
'passwd': settings.DATABASE_PASSWORD,
|
||||||
'host': settings.DATABASE_HOST,
|
|
||||||
'conv': django_conversions,
|
'conv': django_conversions,
|
||||||
}
|
}
|
||||||
|
if settings.DATABASE_HOST.startswith('/'):
|
||||||
|
kwargs['unix_socket'] = settings.DATABASE_HOST
|
||||||
|
else:
|
||||||
|
kwargs['host'] = settings.DATABASE_HOST
|
||||||
if settings.DATABASE_PORT:
|
if settings.DATABASE_PORT:
|
||||||
kwargs['port'] = int(settings.DATABASE_PORT)
|
kwargs['port'] = int(settings.DATABASE_PORT)
|
||||||
self.connection = Database.connect(**kwargs)
|
self.connection = Database.connect(**kwargs)
|
||||||
|
@ -239,6 +239,14 @@ Default: ``''`` (Empty string)
|
|||||||
Which host to use when connecting to the database. An empty string means
|
Which host to use when connecting to the database. An empty string means
|
||||||
localhost. Not used with SQLite.
|
localhost. Not used with SQLite.
|
||||||
|
|
||||||
|
If this value starts with a forward slash (``'/'``) and you're using MySQL,
|
||||||
|
MySQL will connect via a Unix socket to the specified socket. For example::
|
||||||
|
|
||||||
|
DATABASE_HOST = '/var/run/mysql'
|
||||||
|
|
||||||
|
If you're using MySQL and this value *doesn't* start with a forward slash, then
|
||||||
|
this value is assumed to be the host.
|
||||||
|
|
||||||
DATABASE_NAME
|
DATABASE_NAME
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user