LINUX.ORG.RU
ФорумAdmin

MOD_PYTHON ERROR - DJANGO+APACHE


0

1

Доброго времени суток! Поставил django, apache и mod_python на ubuntu server 10.04 LTS. Файлы проекта mysite лежат в /home/user/django/mysite/

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

DEBUG = True
TEMPLATE_DEBUG = DEBUG

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/user1/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 = '[url]http://static.myhost.com[/url]' or MEDIA_URL = '[url]http://myhost.com/static/[/url]'
MEDIA_URL = '[url]http://192.168.1.5/media/[/url]'

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_HOST_PASSWORD = ''  # qwerty
EMAIL_ADDRESS_FROM = ''   # [email]noreply@myhost.com[/email]
if DEBUG:
    EMAIL_FAIL_SILENTLY = False
else:
    EMAIL_FAIL_SILENTLY = True

# 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"
    </Location>

Alias /media /home/user/www/media

<Location "/media">
    SetHandler None
</Location>

При запуске теста python manage.py runserver 0:8000 могу заходить на http://192.168.1.5:8000/ При обращении к http://192.168.1.5/ вылезает такое:

MOD_PYTHON ERROR

ProcessId:      23788
Interpreter:    '127.0.1.1'

ServerName:     '127.0.1.1'
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__
    self.load_middleware()

  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__
    self._setup()

  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 mysite 'opentodo.settings' (Is it on sys.path? Does it have syntax errors?): No module named mysite.settings

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

No module named mysite.settings

что за модуль mysite.settings?

Pinkbyte ★★★★★ ()

начни с изучения uwsgi/gunicorn итд итп.

xpahos ★★★★★ ()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.