demet8
demet8

Reputation: 1109

Django, Python, Mysql

This is the settings.py file for python. I set mysql up via macports (mysql5 & mysqldb) The problem is that I am unsure if I have settings.py configuration correct before I sync the db. Should the PORT be left blank? I believe it should. I know on my Mamp install I have it set to 3306. Thanks....

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql'
        'NAME':   'jenniwren'                     # Or path to database file if using sqlite3.
        'USER': '***'                     # Not used with sqlite3.
        'PASSWORD': '****'                  # Not used with sqlite3.
        'HOST': '/var/run/mysql5/mysqld.sock'                      # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
    }
}

update: this is what I am getting when I test the db in the shell..

demetrius-fords-macbook-pro-17:jenniwren demet8$ python manage.py dbshell Traceback (most recent call last): File "manage.py", line 4, in import settings # Assumed to be in the same directory. File "/Users/demet8/python_projects/jenniwren/settings.py", line 15 'NAME': 'jenniwren' # Or path to database file if using sqlite3. ^ SyntaxError: invalid syntax

Upvotes: 0

Views: 1102

Answers (1)

JAL
JAL

Reputation: 21563

3306 is the default, so that should be fine.

Why do you have the host set to that? I haven't used MySQL on a Mac, but on Linux the host is 'localhost'.

The 'invalid syntax' is because you do't have a comma after the host string - wait, after any of the strings but the last one - and that is invalid syntax for Python dictionary.

Upvotes: 1

Related Questions