Opened 13 years ago

Closed 13 years ago

#16143 closed Bug (needsinfo)

Default settings.py file should fully qualify database name setting

Reported by: anonymous Owned by: nobody
Component: Core (Other) Version: 1.3
Severity: Normal Keywords: settings, database name, sqlite3
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

While struggling through trying to get a WSGI implementation of Django+Pinax up and running, I finally went back to the basics and just tried to get an "out of the box" Pinax basic project working.

It worked fine using the development web server, but failed with the WSGI setup.

I finally narrowed it down to the fact that Apache couldn't find the sqlite3 database. And that was because the name wasn't fully qualified.

My solution was to change the default definition of the database name in settings.py to

"NAME": os.path.join(PROJECT_ROOT,"dev.db"),

it was:

"NAME": "dev.db",

Not a major bug here, but I believe that the "out of the box" solution should work in multiple environments without jumping through a lot of hoops. It just would have made my troubleshooting tonight a lot easier.

Change History (2)

comment:1 by anonymous, 13 years ago

Edit:
This might not be an ideal solution, though, because if you change the type of database to mySQL (or another), then the name shouldn't be so complicated.

comment:2 by Aymeric Augustin, 13 years ago

Resolution: needsinfo
Status: newclosed

In the default project template, the default value of NAME is empty : https://code.djangoproject.com/browser/django/trunk/django/conf/project_template/settings.py

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': '',                      # Or path to database file if using sqlite3.
        'USER': '',                      # Not used with sqlite3.
        'PASSWORD': '',                  # Not used with sqlite3.
        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
    }
}

The tutorial docs are unambiguous : https://docs.djangoproject.com/en/1.3/intro/tutorial01/#database-setup

NAME -- The name of your database. If you're using SQLite, the database will be a file on your computer; in that case, NAME should be the full absolute path, including filename, of that file


I don't understand how you obtained an "out of the box" solution with a relative name. Please tell us where you got that misleading information and re-open the ticket

Note that if the problem is in Pinax, you should report it at http://code.pinaxproject.com/and not here.

Note: See TracTickets for help on using tickets.
Back to Top