Jump to content
Sign in to follow this  

Recommended Posts

Доброго времени суток!

Поставил django, apache и mod_python на ubuntu server 10.04 LTS.

Файлы проекта mysite лежат в /home/user/django/mysite/

Файл проекта settings.py:

Показать скрытый текст
DEBUG = True


DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.

DATABASE_NAME = 'mysite' # Or path to database file if using sqlite3.

DATABASE_USER = 'root' # Not used with sqlite3.

DATABASE_PASSWORD = 'root' # 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.

# Absolute path to the directory that holds media.

# MEDIA_ROOT = '/var/www/media'

MEDIA_ROOT = '/home/user/www/media'

# URL that handles the media served from MEDIA_ROOT.

# Note that this should have a trailing slash if it has a path component

# MEDIA_URL = 'http://static.myhost.com' or MEDIA_URL = 'http://myhost.com/static/'


SEND_EMAILS = False # make it True and edit settings bellow if you want to receive emails

EMAIL_HOST = '' # smtp.myhost.com

EMAIL_HOST_USER = '' # user123


EMAIL_ADDRESS_FROM = '' # noreply@myhost.com





# Make this unique, and don't share it with anybody.

SECRET_KEY = '************************************'

Конфигурационный файл apache http.conf

Показать скрытый текст
LoadModule python_module /usr/lib/apache2/modules/mod_python.so

<Location "/">

SetHandler python-program

PythonHandler django.core.handlers.modpython

SetEnv DJANGO_SETTINGS_MODULE mysite.settings

PythonOption django.root /mysite

PythonDebug On

PythonPath "['/home/user/django/'] + sys.path"


Alias /media /home/user/www/media

<Location "/media">

SetHandler None


При запуске теста python manage.py runserver 0:8000 могу заходить на

При обращении к вылезает такое:

Показать скрытый текст

ProcessId: 23788

Interpreter: ''

ServerName: ''

DocumentRoot: '/var/www'

URI: '/'

Location: '/'

Directory: None

Filename: '/var/www/'

PathInfo: ''

Phase: 'PythonHandler'

Handler: 'django.core.handlers.modpython'

Traceback (most recent call last):

File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1537, in HandlerDispatch

default=default_handler, arg=req, silent=hlist.silent)

File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1229, in _process_target

result = _execute_target(config, req, object, arg)

File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1128, in _execute_target

result = object(arg)

File " /usr/lib/pymodules/python2.6/django/core/handlers/modpython. py ", line 228, in handler

return ModPythonHandler()(req)

File " /usr/lib/pymodules/python2.6/django/core/handlers/modpython. py ", line 191, in __call__


File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py", line 33, in load_middleware

for middleware_path in settings.MIDDLEWARE_CLASSES:

File "/usr/lib/pymodules/python2.6/django/utils/functional.py", line 269, in __getattr__


File "/usr/lib/pymodules/python2.6/django/conf/__init__.py", line 40, in _setup

self._wrapped = Settings(settings_module)

File "/usr/lib/pymodules/python2.6/django/conf/__init__.py", line 75, in __init__

raise ImportError, "Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)

ImportError: Could not import settings 'mysite.settings' (Is it on sys.path? Does it have syntax errors?): No module named mysite.settings

Прошу помочь разобраться, почему возникает MOD_PYTHON ERROR.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...