Is the WSGI server running as www-data user, perhaps?  Check the permissions on 
the file with "ls -l".   Simple check would be "chmod a+rw <yourdbfile>"  to 
guarantee that it is writable by www-data.  

Brian Schott
bfsch...@gmail.com



On Feb 18, 2012, at 4:24 PM, j...@jsdey.com wrote:

> I'm another newbe and need you patient consideration.
> 
> I've worked my way through the polls tutorial.  Thinks seem to be
> working with django server.  When I use Django/Wsgi I vote from an
> external site but django is unable to open database from the line
> selected_choice.save().  The error message from debug is listed
> below.  Any guidance would be greatly appeciated. Thanks.
> 
> John
> 
> DatabaseError at /polls/1/vote/
> 
> unable to open database file
> 
> Request Method:       POST
> Request URL:  http://jsdey.com/polls/1/vote/
> Django Version:       1.3.1
> Exception Type:       DatabaseError
> Exception Value:
> 
> unable to open database file
> 
> Exception Location:   /usr/local/lib/python2.7/dist-packages/django/db/
> backends/sqlite3/base.py in execute, line 234
> Python Executable:    /usr/bin/python
> Python Version:       2.7.1
> Python Path:
> 
> ['/usr/lib/python2.7',
> '/usr/lib/python2.7/plat-linux2',
> '/usr/lib/python2.7/lib-tk',
> '/usr/lib/python2.7/lib-old',
> '/usr/lib/python2.7/lib-dynload',
> '/usr/local/lib/python2.7/dist-packages',
> '/usr/lib/python2.7/dist-packages',
> '/usr/lib/python2.7/dist-packages/gtk-2.0',
> '/usr/lib/pymodules/python2.7',
> '/home/robo5/Django',
> '/home/robo5/Django/mysite']
> 
> Server time:  Sat, 18 Feb 2012 15:15:47 -0600
> Traceback Switch to copy-and-paste view
> 
>    /usr/local/lib/python2.7/dist-packages/django/core/handlers/
> base.py in get_response
> 
>                                response = callback(request,
> *callback_args, **callback_kwargs)
> 
>        ...
>    ▶ Local vars
>    /home/robo5/Django/mysite/polls/views.py in vote
> 
>                selected_choice.save()
> 
>        ...
>    ▶ Local vars
>    /usr/local/lib/python2.7/dist-packages/django/db/models/base.py in
> save
> 
>                self.save_base(using=using, force_insert=force_insert,
> force_update=force_update)
> 
>        ...
>    ▶ Local vars
>    /usr/local/lib/python2.7/dist-packages/django/db/models/base.py in
> save_base
> 
>                                rows =
> manager.using(using).filter(pk=pk_val)._update(values)
> 
>        ...
>    ▶ Local vars
>    /usr/local/lib/python2.7/dist-packages/django/db/models/query.py
> in _update
> 
>                return query.get_compiler(self.db).execute_sql(None)
> 
>        ...
>    ▶ Local vars
>    /usr/local/lib/python2.7/dist-packages/django/db/models/sql/
> compiler.py in execute_sql
> 
>                cursor = super(SQLUpdateCompiler,
> self).execute_sql(result_type)
> 
>        ...
>    ▶ Local vars
>    /usr/local/lib/python2.7/dist-packages/django/db/models/sql/
> compiler.py in execute_sql
> 
>                cursor.execute(sql, params)
> 
>        ...
>    ▶ Local vars
>    /usr/local/lib/python2.7/dist-packages/django/db/backends/util.py
> in execute
> 
>                    return self.cursor.execute(sql, params)
> 
>        ...
>    ▶ Local vars
>    /usr/local/lib/python2.7/dist-packages/django/db/backends/sqlite3/
> base.py in execute
> 
>                    return Database.Cursor.execute(self, query,
> params)
> 
>        ...
>    ▶ Local vars
> 
> Request information
> GET
> 
> No GET data
> POST
> Variable      Value
> csrfmiddlewaretoken
> 
> u'de79b7a128450683be3814aad7a1af65'
> 
> choice
> 
> u'1'
> 
> FILES
> 
> No FILES data
> COOKIES
> Variable      Value
> csrftoken
> 
> 'de79b7a128450683be3814aad7a1af65'
> 
> __utma
> 
> '164886436.1396980123.1309309134.1325027492.1325041095.10'
> 
> __utmz
> 
> '164886436.1309309134.1.1.utmcsr=(direct)|utmccn=(direct)|
> utmcmd=(none)'
> 
> META
> Variable      Value
> mod_wsgi.listener_port
> 
> '80'
> 
> HTTP_COOKIE
> 
> '__utma=164886436.1396980123.1309309134.1325027492.1325041095.10;
> __utmz=164886436.1309309134.1.1.utmcsr=(direct)|utmccn=(direct)|
> utmcmd=(none); csrftoken=de79b7a128450683be3814aad7a1af65'
> 
> mod_wsgi.listener_host
> 
> ''
> 
> SERVER_SOFTWARE
> 
> 'Apache/2.2.17 (Ubuntu)'
> 
> SCRIPT_NAME
> 
> u''
> 
> mod_wsgi.handler_script
> 
> ''
> 
> SERVER_SIGNATURE
> 
> '<address>Apache/2.2.17 (Ubuntu) Server at jsdey.com Port 80</address>
> \n'
> 
> REQUEST_METHOD
> 
> 'POST'
> 
> PATH_INFO
> 
> u'/polls/1/vote/'
> 
> SERVER_PROTOCOL
> 
> 'HTTP/1.1'
> 
> QUERY_STRING
> 
> ''
> 
> CONTENT_LENGTH
> 
> '61'
> 
> HTTP_ACCEPT_CHARSET
> 
> 'ISO-8859-1,utf-8;q=0.7,*;q=0.7'
> 
> HTTP_USER_AGENT
> 
> 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:9.0.1) Gecko/20100101
> Firefox/9.0.1'
> 
> HTTP_CONNECTION
> 
> 'keep-alive'
> 
> HTTP_REFERER
> 
> 'http://jsdey.com/polls/1/'
> 
> SERVER_NAME
> 
> 'jsdey.com'
> 
> REMOTE_ADDR
> 
> '96.242.86.85'
> 
> mod_wsgi.request_handler
> 
> 'wsgi-script'
> 
> wsgi.url_scheme
> 
> 'http'
> 
> PATH_TRANSLATED
> 
> '/home/robo5/Django/mysite/apache/django.wsgi/polls/1/vote/'
> 
> SERVER_PORT
> 
> '80'
> 
> wsgi.multiprocess
> 
> True
> 
> mod_wsgi.input_chunked
> 
> '0'
> 
> SERVER_ADDR
> 
> '192.168.1.3'
> 
> DOCUMENT_ROOT
> 
> '/home/robo5/Django/mysite'
> 
> mod_wsgi.process_group
> 
> 'jsdey.com'
> 
> SCRIPT_FILENAME
> 
> '/home/robo5/Django/mysite/apache/django.wsgi'
> 
> SERVER_ADMIN
> 
> 'j...@jsdey.com'
> 
> wsgi.input
> 
> <mod_wsgi.Input object at 0x7fb2b8dd81f0>
> 
> HTTP_HOST
> 
> 'jsdey.com'
> 
> wsgi.multithread
> 
> True
> 
> mod_wsgi.callable_object
> 
> 'application'
> 
> REQUEST_URI
> 
> '/polls/1/vote/'
> 
> HTTP_ACCEPT
> 
> 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
> 
> wsgi.version
> 
> (1, 1)
> 
> GATEWAY_INTERFACE
> 
> 'CGI/1.1'
> 
> wsgi.run_once
> 
> False
> 
> wsgi.errors
> 
> <mod_wsgi.Log object at 0x7fb2b8dd8db0>
> 
> REMOTE_PORT
> 
> '1024'
> 
> HTTP_ACCEPT_LANGUAGE
> 
> 'en-us,en;q=0.5'
> 
> mod_wsgi.version
> 
> (3, 3)
> 
> CONTENT_TYPE
> 
> 'application/x-www-form-urlencoded'
> 
> mod_wsgi.application_group
> 
> 'www.jsdey.com|'
> 
> mod_wsgi.script_reloading
> 
> '1'
> 
> wsgi.file_wrapper
> 
> ''
> 
> CSRF_COOKIE
> 
> 'de79b7a128450683be3814aad7a1af65'
> 
> HTTP_ACCEPT_ENCODING
> 
> 'gzip, deflate'
> 
> Settings
> Using settings module mysite.settings
> Setting       Value
> USE_L10N
> 
> True
> 
> USE_THOUSAND_SEPARATOR
> 
> False
> 
> LANGUAGE_CODE
> 
> 'en-us'
> 
> ROOT_URLCONF
> 
> 'mysite.urls'
> 
> MANAGERS
> 
> ()
> 
> DEFAULT_CHARSET
> 
> 'utf-8'
> 
> STATIC_ROOT
> 
> ''
> 
> TEST_DATABASE_CHARSET
> 
> None
> 
> MESSAGE_STORAGE
> 
> 'django.contrib.messages.storage.user_messages.LegacyFallbackStorage'
> 
> DATABASE_HOST
> 
> ''
> 
> IGNORABLE_404_STARTS
> 
> ('/cgi-bin/', '/_vti_bin', '/_vti_inf')
> 
> SEND_BROKEN_LINK_EMAILS
> 
> False
> 
> URL_VALIDATOR_USER_AGENT
> 
> 'Django/1.3.1 (http://www.djangoproject.com)'
> 
> STATICFILES_FINDERS
> 
> ('django.contrib.staticfiles.finders.FileSystemFinder',
> 'django.contrib.staticfiles.finders.AppDirectoriesFinder')
> 
> SESSION_COOKIE_DOMAIN
> 
> None
> 
> SESSION_COOKIE_NAME
> 
> 'sessionid'
> 
> COMMENTS_MODERATORS_GROUP
> 
> None
> 
> TIME_INPUT_FORMATS
> 
> ('%H:%M:%S', '%H:%M')
> 
> DATABASES
> 
> {'default': {'ENGINE': 'django.db.backends.sqlite3',
>             'HOST': '',
>             'NAME': '/home/robo5/Django/myDB',
>             'OPTIONS': {},
>             'PASSWORD': '********************',
>             'PORT': '',
>             'TEST_CHARSET': None,
>             'TEST_COLLATION': None,
>             'TEST_MIRROR': None,
>             'TEST_NAME': None,
>             'TIME_ZONE': 'America/Chicago',
>             'USER': ''}}
> 
> TEST_DATABASE_NAME
> 
> None
> 
> FILE_UPLOAD_PERMISSIONS
> 
> None
> 
> FILE_UPLOAD_HANDLERS
> 
> ('django.core.files.uploadhandler.MemoryFileUploadHandler',
> 'django.core.files.uploadhandler.TemporaryFileUploadHandler')
> 
> DEFAULT_CONTENT_TYPE
> 
> 'text/html'
> 
> APPEND_SLASH
> 
> True
> 
> FIRST_DAY_OF_WEEK
> 
> 0
> 
> DATABASE_ROUTERS
> 
> []
> 
> YEAR_MONTH_FORMAT
> 
> 'F Y'
> 
> STATICFILES_STORAGE
> 
> 'django.contrib.staticfiles.storage.StaticFilesStorage'
> 
> CACHES
> 
> {'default': {'BACKEND':
> 'django.core.cache.backends.locmem.LocMemCache',
>             'LOCATION': ''}}
> 
> SERVER_EMAIL
> 
> 'root@localhost'
> 
> SESSION_COOKIE_PATH
> 
> '/'
> 
> USE_X_FORWARDED_HOST
> 
> False
> 
> IGNORABLE_404_ENDS
> 
> ('mail.pl', 'mailform.pl', 'mail.cgi', 'mailform.cgi', 'favicon.ico',
> '.php')
> 
> MIDDLEWARE_CLASSES
> 
> ('django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware')
> 
> USE_I18N
> 
> True
> 
> THOUSAND_SEPARATOR
> 
> ','
> 
> SECRET_KEY
> 
> '********************'
> 
> LANGUAGE_COOKIE_NAME
> 
> 'django_language'
> 
> FILE_UPLOAD_TEMP_DIR
> 
> None
> 
> TRANSACTIONS_MANAGED
> 
> False
> 
> LOGGING_CONFIG
> 
> 'django.utils.log.dictConfig'
> 
> TEMPLATE_LOADERS
> 
> ('django.template.loaders.filesystem.Loader',
> 'django.template.loaders.app_directories.Loader')
> 
> TEMPLATE_DEBUG
> 
> True
> 
> AUTHENTICATION_BACKENDS
> 
> ('django.contrib.auth.backends.ModelBackend',)
> 
> TEST_DATABASE_COLLATION
> 
> None
> 
> FORCE_SCRIPT_NAME
> 
> None
> 
> CACHE_BACKEND
> 
> 'locmem://'
> 
> SESSION_COOKIE_SECURE
> 
> False
> 
> CSRF_COOKIE_DOMAIN
> 
> None
> 
> FILE_CHARSET
> 
> 'utf-8'
> 
> DEBUG
> 
> True
> 
> SESSION_FILE_PATH
> 
> None
> 
> DEFAULT_FILE_STORAGE
> 
> 'django.core.files.storage.FileSystemStorage'
> 
> INSTALLED_APPS
> 
> ['django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.sites',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> 'django.contrib.admin',
> 'polls']
> 
> LANGUAGES
> 
> (('ar', 'Arabic'),
> ('az', 'Azerbaijani'),
> ('bg', 'Bulgarian'),
> ('bn', 'Bengali'),
> ('bs', 'Bosnian'),
> ('ca', 'Catalan'),
> ('cs', 'Czech'),
> ('cy', 'Welsh'),
> ('da', 'Danish'),
> ('de', 'German'),
> ('el', 'Greek'),
> ('en', 'English'),
> ('en-gb', 'British English'),
> ('es', 'Spanish'),
> ('es-ar', 'Argentinian Spanish'),
> ('es-mx', 'Mexican Spanish'),
> ('es-ni', 'Nicaraguan Spanish'),
> ('et', 'Estonian'),
> ('eu', 'Basque'),
> ('fa', 'Persian'),
> ('fi', 'Finnish'),
> ('fr', 'French'),
> ('fy-nl', 'Frisian'),
> ('ga', 'Irish'),
> ('gl', 'Galician'),
> ('he', 'Hebrew'),
> ('hi', 'Hindi'),
> ('hr', 'Croatian'),
> ('hu', 'Hungarian'),
> ('id', 'Indonesian'),
> ('is', 'Icelandic'),
> ('it', 'Italian'),
> ('ja', 'Japanese'),
> ('ka', 'Georgian'),
> ('km', 'Khmer'),
> ('kn', 'Kannada'),
> ('ko', 'Korean'),
> ('lt', 'Lithuanian'),
> ('lv', 'Latvian'),
> ('mk', 'Macedonian'),
> ('ml', 'Malayalam'),
> ('mn', 'Mongolian'),
> ('nl', 'Dutch'),
> ('no', 'Norwegian'),
> ('nb', 'Norwegian Bokmal'),
> ('nn', 'Norwegian Nynorsk'),
> ('pa', 'Punjabi'),
> ('pl', 'Polish'),
> ('pt', 'Portuguese'),
> ('pt-br', 'Brazilian Portuguese'),
> ('ro', 'Romanian'),
> ('ru', 'Russian'),
> ('sk', 'Slovak'),
> ('sl', 'Slovenian'),
> ('sq', 'Albanian'),
> ('sr', 'Serbian'),
> ('sr-latn', 'Serbian Latin'),
> ('sv', 'Swedish'),
> ('ta', 'Tamil'),
> ('te', 'Telugu'),
> ('th', 'Thai'),
> ('tr', 'Turkish'),
> ('uk', 'Ukrainian'),
> ('ur', 'Urdu'),
> ('vi', 'Vietnamese'),
> ('zh-cn', 'Simplified Chinese'),
> ('zh-tw', 'Traditional Chinese'))
> 
> DATABASE_ENGINE
> 
> ''
> 
> DATABASE_NAME
> 
> ''
> 
> COMMENTS_FIRST_FEW
> 
> 0
> 
> PREPEND_WWW
> 
> False
> 
> SESSION_COOKIE_HTTPONLY
> 
> False
> 
> DATABASE_PORT
> 
> ''
> 
> DEBUG_PROPAGATE_EXCEPTIONS
> 
> False
> 
> MONTH_DAY_FORMAT
> 
> 'F j'
> 
> LOGIN_URL
> 
> '/accounts/login/'
> 
> SESSION_EXPIRE_AT_BROWSER_CLOSE
> 
> False
> 
> TIME_FORMAT
> 
> 'P'
> 
> DATE_INPUT_FORMATS
> 
> ('%Y-%m-%d',
> '%m/%d/%Y',
> '%m/%d/%y',
> '%b %d %Y',
> '%b %d, %Y',
> '%d %b %Y',
> '%d %b, %Y',
> '%B %d %Y',
> '%B %d, %Y',
> '%d %B %Y',
> '%d %B, %Y')
> 
> CSRF_COOKIE_NAME
> 
> 'csrftoken'
> 
> EMAIL_HOST_PASSWORD
> 
> '********************'
> 
> PASSWORD_RESET_TIMEOUT_DAYS
> 
> '********************'
> 
> CACHE_MIDDLEWARE_ALIAS
> 
> 'default'
> 
> SESSION_SAVE_EVERY_REQUEST
> 
> False
> 
> ADMIN_MEDIA_PREFIX
> 
> '/static/admin/'
> 
> NUMBER_GROUPING
> 
> 0
> 
> SESSION_ENGINE
> 
> 'django.contrib.sessions.backends.db'
> 
> CSRF_FAILURE_VIEW
> 
> 'django.views.csrf.csrf_failure'
> 
> COMMENTS_SKETCHY_USERS_GROUP
> 
> None
> 
> LOGIN_REDIRECT_URL
> 
> '/accounts/profile/'
> 
> LOGGING
> 
> {'disable_existing_loggers': False,
> 'handlers': {'mail_admins': {'class':
> 'django.utils.log.AdminEmailHandler',
>                              'level': 'ERROR'}},
> 'loggers': {'django.request': {'handlers': ['mail_admins'],
>                                'level': 'ERROR',
>                                'propagate': True}},
> 'version': 1}
> 
> CACHE_MIDDLEWARE_KEY_PREFIX
> 
> ''
> 
> LOCALE_PATHS
> 
> ()
> 
> TEMPLATE_STRING_IF_INVALID
> 
> ''
> 
> COMMENTS_ALLOW_PROFANITIES
> 
> False
> 
> LOGOUT_URL
> 
> '/accounts/logout/'
> 
> EMAIL_USE_TLS
> 
> False
> 
> TEMPLATE_DIRS
> 
> ('/home/robo5/Django/MyTemplates',)
> 
> FIXTURE_DIRS
> 
> ()
> 
> EMAIL_HOST
> 
> 'localhost'
> 
> DATE_FORMAT
> 
> 'N j, Y'
> 
> MEDIA_ROOT
> 
> ''
> 
> ADMINS
> 
> ()
> 
> FORMAT_MODULE_PATH
> 
> None
> 
> DEFAULT_FROM_EMAIL
> 
> 'webmaster@localhost'
> 
> STATICFILES_DIRS
> 
> ()
> 
> MEDIA_URL
> 
> ''
> 
> DATETIME_FORMAT
> 
> 'N j, Y, P'
> 
> EMAIL_SUBJECT_PREFIX
> 
> '[Django] '
> 
> SITE_ID
> 
> 1
> 
> DISALLOWED_USER_AGENTS
> 
> ()
> 
> ALLOWED_INCLUDE_ROOTS
> 
> ()
> 
> DECIMAL_SEPARATOR
> 
> '.'
> 
> SHORT_DATE_FORMAT
> 
> 'm/d/Y'
> 
> DATABASE_USER
> 
> ''
> 
> TEST_RUNNER
> 
> 'django.test.simple.DjangoTestSuiteRunner'
> 
> TIME_ZONE
> 
> 'America/Chicago'
> 
> FILE_UPLOAD_MAX_MEMORY_SIZE
> 
> 2621440
> 
> EMAIL_BACKEND
> 
> 'django.core.mail.backends.smtp.EmailBackend'
> 
> DEFAULT_TABLESPACE
> 
> ''
> 
> TEMPLATE_CONTEXT_PROCESSORS
> 
> ('django.contrib.auth.context_processors.auth',
> 'django.core.context_processors.debug',
> 'django.core.context_processors.i18n',
> 'django.core.context_processors.media',
> 'django.core.context_processors.static',
> 'django.contrib.messages.context_processors.messages')
> 
> SESSION_COOKIE_AGE
> 
> 1209600
> 
> SETTINGS_MODULE
> 
> 'mysite.settings'
> 
> USE_ETAGS
> 
> False
> 
> LANGUAGES_BIDI
> 
> ('he', 'ar', 'fa')
> 
> DEFAULT_INDEX_TABLESPACE
> 
> ''
> 
> INTERNAL_IPS
> 
> ()
> 
> STATIC_URL
> 
> '/static/'
> 
> EMAIL_PORT
> 
> 25
> 
> SHORT_DATETIME_FORMAT
> 
> 'm/d/Y P'
> 
> ABSOLUTE_URL_OVERRIDES
> 
> {}
> 
> DATABASE_OPTIONS
> 
> {}
> 
> CACHE_MIDDLEWARE_SECONDS
> 
> 600
> 
> BANNED_IPS
> 
> ()
> 
> DATETIME_INPUT_FORMATS
> 
> ('%Y-%m-%d %H:%M:%S',
> '%Y-%m-%d %H:%M',
> '%Y-%m-%d',
> '%m/%d/%Y %H:%M:%S',
> '%m/%d/%Y %H:%M',
> '%m/%d/%Y',
> '%m/%d/%y %H:%M:%S',
> '%m/%d/%y %H:%M',
> '%m/%d/%y')
> 
> DATABASE_PASSWORD
> 
> '********************'
> 
> ADMIN_FOR
> 
> ()
> 
> COMMENTS_BANNED_USERS_GROUP
> 
> None
> 
> EMAIL_HOST_USER
> 
> ''
> 
> PROFANITIES_LIST
> 
> '********************'
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to