Django

Code

Changeset 2736

Show
Ignore:
Timestamp:
04/23/06 17:18:53 (3 years ago)
Author:
adrian
Message:

magic-removal: Fixed #1481 -- Added support for using alternate MySQL Unix sockets. Thanks, Geert Vanderkelen

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/magic-removal/django/db/backends/mysql/base.py

    r2735 r2736  
    7676                'db': settings.DATABASE_NAME, 
    7777                'passwd': settings.DATABASE_PASSWORD, 
    78                 'host': settings.DATABASE_HOST, 
    7978                'conv': django_conversions, 
    8079            } 
     80            if settings.DATABASE_HOST.startswith('/'): 
     81                kwargs['unix_socket'] = settings.DATABASE_HOST 
     82            else: 
     83                kwargs['host'] = settings.DATABASE_HOST 
    8184            if settings.DATABASE_PORT: 
    8285                kwargs['port'] = int(settings.DATABASE_PORT) 
  • django/branches/magic-removal/docs/settings.txt

    r2714 r2736  
    239239Which host to use when connecting to the database. An empty string means 
    240240localhost. Not used with SQLite. 
     241 
     242If this value starts with a forward slash (``'/'``) and you're using MySQL, 
     243MySQL will connect via a Unix socket to the specified socket. For example:: 
     244 
     245    DATABASE_HOST = '/var/run/mysql' 
     246 
     247If you're using MySQL and this value *doesn't* start with a forward slash, then 
     248this value is assumed to be the host. 
    241249 
    242250DATABASE_NAME