I have win32,python2.5,django1.2, apache2.2, and mod_python3.3.1
I have installed properly mod_python. Now my application name is myapp.setting which path is c:\myapp.setting. In myapp.settings my file is myapp.settings\url.py,settings.py etc.
now in apache httpd.conf file I have changes following:-
<Location "/mysite">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE myapp.settings
PythonDebug On
PythonPath "['/'] + sys.path"
</Location>
and I have tried many changes in PythonPath. but when i typed http://localhost/mysite the error is following:-
MOD_PYTHON ERROR
ProcessId: 1384
Interpreter: '192.168.1.166'
ServerName: '192.168.1.166'
DocumentRoot: 'C:/Program Files/Apache Software Foundation/Apache2.2/htdocs'
URI: '/mysite'
Location: '/mysite'
Directory: None
Filename: 'C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/mysite'
PathInfo: ''
Phase: 'PythonHandler'
Handler: 'django.core.handlers.modpython'
Traceback (most recent call last):
File "C:\Python25\Lib\site-packages\mod_python\importer.py", line 1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)
File "C:\Python25\Lib\site-packages\mod_python\importer.py", line 1229, in _process_target
result = _execute_target(config, req, object, arg)
File "C:\Python25\Lib\site-packages\mod_python\importer.py", line 1128, in _execute_target
result = object(arg)
File "C:\Python25\Lib\site-packages\django\core\handlers\modpython.py", line 228, in handler
return ModPythonHandler()(req)
File "C:\Python25\Lib\site-packages\django\core\handlers\modpython.py", line 191, in __call__
self.load_middleware()
File "C:\Python25\Lib\site-packages\django\core\handlers\base.py", line 33, in load_middleware
for middleware_path in settings.MIDDLEWARE_CLASSES:
File "C:\Python25\Lib\site-packages\django\utils\functional.py", line 276, in __getattr__
self._setup()
File "C:\Python25\Lib\site-packages\django\conf\__init__.py", line 40, in _setup
self._wrapped = Settings(settings_module)
File "C:\Python25\Lib\site-packages\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 'myapp.settings' (Is it on sys.path? Does it have syntax errors?): No module named myapp.settings
Please help me I am new in Django...
myapp.settings? This is wrong, your app should be called app and settings.py should be file in the project, the way it is now settings are probably located inmyapp.settings.settings, and you can't have dot in package names in python AFAIK.myproject.FacebookConnectMiddlewareis probably in some file insidemyprojectso insert that files name in the module path. Something like:myproject.filename.FacebookConnectMiddleware.myproject.FacebookConnectMiddlewaremakes it look like the actual middleware code is in projects__init__.py