rohitbansal2009
rohitbansal2009

Reputation: 31

error on running my application in Django with mod_python

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

Upvotes: 0

Views: 518

Answers (1)

Daniel Roseman
Daniel Roseman

Reputation: 599450

As rebus says in his comment, it's nonsense to call your project 'myapp.settings'. It's neither an app (which is a component of a site), nor is it a settings file. Call it something sensible - if you really can't think of anything, call it 'mysite'.

Finally, however, you should not be using mod_python. Use mod_wsgi instead.

Upvotes: 2

Related Questions