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

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/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/'

MEDIA_URL = 'http://192.168.1.5/media/'

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 = '' # noreply@myhost.com

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 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.

Guest
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.

Loading...
Sign in to follow this  

×
×
  • Create New...