Ticket #618: database_port.patch

File database_port.patch, 3.1 KB (added by Esaj, 10 years ago)
  • django/conf/project_template/settings/main.py

     
    1515DATABASE_USER = ''             # Not used with sqlite3.
    1616DATABASE_PASSWORD = ''         # Not used with sqlite3.
    1717DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
     18DATABASE_PORT = ''             # Set to empty string for default. Not used with sqlite3.
    1819
    1920SITE_ID = 1
    2021
  • django/conf/global_settings.py

     
    5050DATABASE_USER = ''
    5151DATABASE_PASSWORD = ''
    5252DATABASE_HOST = ''             # Set to empty string for localhost
     53DATABASE_PORT = ''             # Set to empty string for default
    5354
    5455# Host for sending e-mail.
    5556EMAIL_HOST = 'localhost'
  • django/core/db/backends/postgresql.py

     
    1515        self.queries = []
    1616
    1717    def cursor(self):
    18         from django.conf.settings import DATABASE_USER, DATABASE_NAME, DATABASE_HOST, DATABASE_PASSWORD, DEBUG, TIME_ZONE
     18        from django.conf.settings import DATABASE_USER, DATABASE_NAME, DATABASE_HOST, DATABASE_PORT, DATABASE_PASSWORD, DEBUG, TIME_ZONE
    1919        if self.connection is None:
    2020            if DATABASE_NAME == '':
    2121                from django.core.exceptions import ImproperlyConfigured
     
    2727                conn_string += " password=%s" % DATABASE_PASSWORD
    2828            if DATABASE_HOST:
    2929                conn_string += " host=%s" % DATABASE_HOST
     30            if DATABASE_PORT:
     31                conn_string += " port=%s" % DATABASE_PORT
    3032            self.connection = Database.connect(conn_string)
    3133            self.connection.set_isolation_level(1) # make transactions transparent to all cursors
    3234        cursor = self.connection.cursor()
  • django/core/db/backends/mysql.py

     
    5353        self.queries = []
    5454
    5555    def cursor(self):
    56         from django.conf.settings import DATABASE_USER, DATABASE_NAME, DATABASE_HOST, DATABASE_PASSWORD, DEBUG
     56        from django.conf.settings import DATABASE_USER, DATABASE_NAME, DATABASE_HOST, DATABASE_PORT, DATABASE_PASSWORD, DEBUG
    5757        if self.connection is None:
    5858            self.connection = Database.connect(user=DATABASE_USER, db=DATABASE_NAME,
    59                 passwd=DATABASE_PASSWORD, host=DATABASE_HOST, conv=django_conversions)
     59                passwd=DATABASE_PASSWORD, host=DATABASE_HOST, port=DATABASE_PORT, conv=django_conversions)
    6060        if DEBUG:
    6161            return base.CursorDebugWrapper(MysqlDebugWrapper(self.connection.cursor()), self)
    6262        return self.connection.cursor()
Back to Top