У меня:
Linux Mint 9
Python 2.6.5
mod_python 3.3.1
Django 1.1.2
Apache 2.2.14
Вот что находится в логах apache error.log при переходе по ссылке http://127.0.0.3/admin/
mod_python (pid=17272, interpreter='www.mag.com', phase='PythonHandler', handler='django.core.handlers.modpython'): Application error
ServerName: ‘www.mag.com’
DocumentRoot: ‘/htdocs’
URI: ‘/admin/’
Location: ‘/’
Directory: None
Filename: ‘/htdocs’
PathInfo: ‘/admin/’
Traceback (most recent call last):
File “/usr/lib/python2.6/dist-packages/mod_python/importer.py”, line 1537, in HandlerDispatch\n default=default_handler, arg=req, silent=hlist.silent)
File “/usr/lib/python2.6/dist-packages/mod_python/importer.py”, line 1229, in _process_target\n result = _execute_target(config, req, object, arg)
File “/usr/lib/python2.6/dist-packages/mod_python/importer.py”, line 1128, in _execute_target\n result = object(arg)
File “/usr/lib/python2.6/dist-packages/django/core/handlers/modpython.py”, line 228, in handler\n return ModPythonHandler()(req)
File “/usr/lib/python2.6/dist-packages/django/core/handlers/modpython.py”, line 205, in __call__\n response = middleware_method(request, response)
File “/usr/lib/python2.6/dist-packages/django/contrib/sessions/middleware.py”, line 36, in process_response\n request.session.save()
File “/usr/lib/python2.6/dist-packages/django/contrib/sessions/backends/db.py”, line 58, in save\n obj.save(force_insert=must_create)
File “/usr/lib/python2.6/dist-packages/django/db/models/base.py”, line 431, in save\n self.save_base(force_insert=force_insert, force_update=force_update)
File “/usr/lib/python2.6/dist-packages/django/db/models/base.py”, line 516, in save_base\n result = manager._insert(values, return_id=update_pk)
File “/usr/lib/python2.6/dist-packages/django/db/models/manager.py”, line 176, in _insert\n return insert_query(self.model, values, **kwargs)
File “/usr/lib/python2.6/dist-packages/django/db/models/query.py”, line 1109, in insert_query\n return query.execute_sql(return_id)
File “/usr/lib/python2.6/dist-packages/django/db/models/sql/subqueries.py”, line 324, in execute_sql\n cursor = super(InsertQuery, self).execute_sql(None)
File “/usr/lib/python2.6/dist-packages/django/db/models/sql/query.py”, line 2347, in execute_sql\n cursor.execute(sql, params)
File “/usr/lib/python2.6/dist-packages/django/db/backends/util.py”, line 19, in execute\n return self.cursor.execute(sql, params)
File “/usr/lib/python2.6/dist-packages/django/db/backends/sqlite3/base.py”, line 201, in execute\n return Database.Cursor.execute(self, query, params)
OperationalError: unable to open database file
Настройки httpd.conf. Возможно в нем будет что то лишнее.
1 LoadModule python_module modules/mod_python.so
2
3 <VirtualHost 127.0.0.3>
4 ServerName www.mag.com
5 <Location "/">
6 SetHandler python-program
7 PythonHandler django.core.handlers.modpython
8 SetEnv DJANGO_SETTINGS_MODULE magazine.settings
9 PythonDebug On
10 PythonPath "['htdocs', '/home/byka/desktop/net_magazine', '/usr/lib/python2.6/dist-packages/django'] + sys.path"
11 </Location>
12 <Location '/static/'>
13 SetHandler None
14 </Location>
15 Alias "/media/" "/usr/lib/python2.6/dist-packages/django/contrib/admin/media/"
16
21 </VirtualHost>
# Django settings for magazine project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = '/home/byka/desktop/net_magazine/magazine/net.db' # Or path to database file if using sqlite3.
DATABASE_USER = '' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/Chicago'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = '/home/byka/desktop/net_magazine/magazine/media/'
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
MEDIA_URL = 'media/'
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/media/'
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'x4$x2_ui6jtho0*jt%=lv$0pu(y$&@m4%700ju1t!x1$$4798i'
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source',
# 'django.template.loaders.eggs.load_template_source',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.locale.LocaleMiddleware',
)
ROOT_URLCONF = 'magazine.urls'
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
'/home/byka/desktop/net_magazine/magazine/template/',
'/home/byka/desktop/net_magazine/magazine/static/',
'/home/byka/desktop/net_magazine/magazine/media/',
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
# 'django.contrib.sites',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
'magazine.mag',
)
'
urlpatterns = patterns('',
# Example:
# (r'^magazine/', include('magazine.foo.urls')),
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
# to INSTALLED_APPS to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
(r'^admin/', include(admin.site.urls)),
#(r'^print_items/', print_items),
(r'^main-page/$', main_page),
(r'^main-page/menu/(\d{1,2})/$', menu),
#(r'^main-page/\d{1,2}/$', products_in_category),
#(r'^main-page/\d{1,2}/(?P<s_category>\d{1,2})/(?P<sort>\w+)/$', products_in_sybcategory),
(r'^main-page/\d{1,2}/(\d{1,2})/$', products_in_sybcategory),
(r'^main-page/\d{1,2}/(?P<s_category>\d{1,2})/(?P<sort>\w+)/$', products_in_sybcategory_sort),
(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': 'static'}),
(r'^main-page/media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': 'media'}),
)Быстрее всего проблема в корявых руках, но где они накосячили я пока не знаю.