views:

49

answers:

1

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

A: 

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.

Alex JL
demet8
I'm actually installing MacPorts and MySQL on my macbook today, too! If I notice anything about MySQL configuration for Django I'll make a note here.
Alex JL
If you are using MacPorts, you need to ensure that your shell search path includes /opt/local/bin; if you are also using a MacPorts Python, you need to include its bin directory, so something like this: export PATH="/opt/local/bin:/opt/local/Library/Frameworks/Python.framework/Versions/Current/bin:/opt/local/bin:$PATH"
Ned Deily
Thanks Ned i'll give it a try...
demet8
demet8
Thanks @demet8, I'll probably need that! I didn't get very far installing mysql on my Mac earlier today...
Alex JL