khayman218
April 21st, 2008, 09:42 PM
I have installed Apache, modpython and Django via apt-get. Apache and modpython are working (I can serve normal files and python script output). However, I am unable to serve the initial Django project.
Here is the httpd.conf:
<Location "/organik/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE settings.py
PythonDebug On
PythonPath "['/var/www/secure_html' , '/home/khayman218/python'] + sys.path"
</Location>
The code for the project is in /home/khayman218/python/organik:
khayman218@Khayserv:/var/www/secure_html/organik$ ls /home/khayman218/python/organik/ -l
total 20
-rw-r--r-- 1 khayman218 khayman218 0 Apr 21 13:17 __init__.py
-rw-r--r-- 1 khayman218 khayman218 141 Apr 21 13:18 __init__.pyc
-rwxr-xr-x 1 khayman218 khayman218 542 Apr 21 13:17 manage.py
-rw-r--r-- 1 khayman218 khayman218 2842 Apr 21 13:29 settings.py
-rw-r--r-- 1 khayman218 khayman218 1807 Apr 21 13:29 settings.pyc
-rw-r--r-- 1 khayman218 khayman218 227 Apr 21 13:17 urls.py
When I attempt to access the /organik url, I get the following error:
MOD_PYTHON ERROR
ProcessId: 9380
Interpreter: '127.0.0.1'
ServerName: '127.0.0.1'
DocumentRoot: '/var/www/secure_html'
URI: '/organik/'
Location: '/organik/'
Directory: None
Filename: '/var/www/secure_html/organik/'
PathInfo: ''
Phase: 'PythonHandler'
Handler: 'django.core.handlers.modpython'
Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)
File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1229, in _process_target
result = _execute_target(config, req, object, arg)
File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1128, in _execute_target
result = object(arg)
File "/var/lib/python-support/python2.5/django/core/handlers/modpython.py", line 177, in handler
return ModPythonHandler()(req)
File "/var/lib/python-support/python2.5/django/core/handlers/modpython.py", line 145, in __call__
self.load_middleware()
File "/var/lib/python-support/python2.5/django/core/handlers/base.py", line 22, in load_middleware
for middleware_path in settings.MIDDLEWARE_CLASSES:
File "/var/lib/python-support/python2.5/django/conf/__init__.py", line 28, in __getattr__
self._import_settings()
File "/var/lib/python-support/python2.5/django/conf/__init__.py", line 55, in _import_settings
self._target = Settings(settings_module)
File "/var/lib/python-support/python2.5/django/conf/__init__.py", line 83, in __init__
raise EnvironmentError, "Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)
EnvironmentError: Could not import settings 'settings.py' (Is it on sys.path? Does it have syntax errors?): No module named settings.py
From what I have been able to find on the intarweb, it looks like settings.py simply isn't being found. I have put every variation of diretories in the PythonPath (in httpd.conf) and it still cannot find it.
Any ideas on what I am missing?
Thanks.
Here is the httpd.conf:
<Location "/organik/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE settings.py
PythonDebug On
PythonPath "['/var/www/secure_html' , '/home/khayman218/python'] + sys.path"
</Location>
The code for the project is in /home/khayman218/python/organik:
khayman218@Khayserv:/var/www/secure_html/organik$ ls /home/khayman218/python/organik/ -l
total 20
-rw-r--r-- 1 khayman218 khayman218 0 Apr 21 13:17 __init__.py
-rw-r--r-- 1 khayman218 khayman218 141 Apr 21 13:18 __init__.pyc
-rwxr-xr-x 1 khayman218 khayman218 542 Apr 21 13:17 manage.py
-rw-r--r-- 1 khayman218 khayman218 2842 Apr 21 13:29 settings.py
-rw-r--r-- 1 khayman218 khayman218 1807 Apr 21 13:29 settings.pyc
-rw-r--r-- 1 khayman218 khayman218 227 Apr 21 13:17 urls.py
When I attempt to access the /organik url, I get the following error:
MOD_PYTHON ERROR
ProcessId: 9380
Interpreter: '127.0.0.1'
ServerName: '127.0.0.1'
DocumentRoot: '/var/www/secure_html'
URI: '/organik/'
Location: '/organik/'
Directory: None
Filename: '/var/www/secure_html/organik/'
PathInfo: ''
Phase: 'PythonHandler'
Handler: 'django.core.handlers.modpython'
Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)
File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1229, in _process_target
result = _execute_target(config, req, object, arg)
File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1128, in _execute_target
result = object(arg)
File "/var/lib/python-support/python2.5/django/core/handlers/modpython.py", line 177, in handler
return ModPythonHandler()(req)
File "/var/lib/python-support/python2.5/django/core/handlers/modpython.py", line 145, in __call__
self.load_middleware()
File "/var/lib/python-support/python2.5/django/core/handlers/base.py", line 22, in load_middleware
for middleware_path in settings.MIDDLEWARE_CLASSES:
File "/var/lib/python-support/python2.5/django/conf/__init__.py", line 28, in __getattr__
self._import_settings()
File "/var/lib/python-support/python2.5/django/conf/__init__.py", line 55, in _import_settings
self._target = Settings(settings_module)
File "/var/lib/python-support/python2.5/django/conf/__init__.py", line 83, in __init__
raise EnvironmentError, "Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)
EnvironmentError: Could not import settings 'settings.py' (Is it on sys.path? Does it have syntax errors?): No module named settings.py
From what I have been able to find on the intarweb, it looks like settings.py simply isn't being found. I have put every variation of diretories in the PythonPath (in httpd.conf) and it still cannot find it.
Any ideas on what I am missing?
Thanks.