Because my application works fine with Django development server (http://locahost:8000) on the same machine, I assume the problem does not reside in my application code. Then it must be due to the configuration of Apache. Do I need to modify my code to make it work with Apache/mod_python?
Here is the information after I set DEBUG=True. ********************************************* ViewDoesNotExist at / Could not import views. Error was: No module named viewsRequest Method: GET Request URL: http://www.domain.com/ Exception Type: ViewDoesNotExist Exception Value: Could not import views. Error was: No module named views Exception Location: C:\Python25\lib\site-packages\django\core \urlresolvers.py in _get_callback, line 132 Python Executable: C:\Program Files\Apache Software Foundation \Apache2.2\bin\httpd.exe Python Version: 2.5.2 Traceback Switch to copy-and-paste view C:\Python25\lib\site-packages\django\core\handlers\base.py in get_response # Get urlconf from request object, if available. Otherwise use default. urlconf = getattr(request, "urlconf", settings.ROOT_URLCONF) resolver = urlresolvers.RegexURLResolver (r'^/', urlconf) try: callback, callback_args, callback_kwargs = resolver.resolve ( request.path_info) ... # Apply view middleware for middleware_method in self._view_middleware: response = middleware_method (request, callback, callback_args, callback_kwargs) if response: return response? Local vars Variable Value exc_info (<class 'django.core.exceptions.ViewDoesNotExist'>, ViewDoesNotExist('Could not import views. Error was: No module named views',), <traceback object at 0x02393120>) exceptions <module 'django.core.exceptions' from 'C:\Python25\lib\site- packages\django\core\exceptions.pyc'> middleware_method <bound method AuthenticationMiddleware.process_request of <django.contrib.auth.middleware.AuthenticationMiddleware object at 0x01FC4F30>> receivers [(<function _rollback_on_exception at 0x020633B0>, None)] request <ModPythonRequest path:/, GET:<QueryDict: {}>, POST:<QueryDict: {}>, , META:{'AUTH_TYPE': None, 'CONTENT_LENGTH': 0L, 'CONTENT_TYPE': 'httpd/unix-directory', 'GATEWAY_INTERFACE': 'CGI/ 1.1', 'HTTP_ACCEPT': '*/*', 'HTTP_ACCEPT_ENCODING': 'gzip, deflate', ;q=0.5', 'HTTP_CONNECTION': 'Keep-Alive', , 'HTTP_HOST': 'www.domain.com', 'HTTP_IF_MODIFIED_SINCE': 'Sat, 15 Nov 2008 03:40:20 GMT', , 'HTTP_UA_CPU': 'x86', ', 'PATH_INFO': u'/', 'PATH_TRANSLATED': None, 'QUERY_STRING': None, , 'REMOTE_HOST': None, 'REMOTE_IDENT': None, 'REMOTE_USER': None, 'REQUEST_METHOD': 'GET', 'SCRIPT_NAME': '', 'SERVER_NAME': 'domain.com', 'SERVER_PORT': 80, 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SOFTWARE': 'mod_python'}> resolver <RegexURLResolver homedomain.urls ^/> response None self <django.core.handlers.modpython.ModPythonHandler object at 0x01DF01B0> settings <django.conf.LazySettings object at 0x01E15C90> urlconf 'homedomain.urls' urlresolvers <module 'django.core.urlresolvers' from 'C:\Python25\lib \site-packages\django\core\urlresolvers.pyc'> C:\Python25\lib\site-packages\django\core\urlresolvers.py in resolve def resolve(self, path): tried = [] match = self.regex.search(path) if match: new_path = path [match.end():] for pattern in self.urlconf_module.urlpatterns: try: sub_match = pattern.resolve (new_path) ... except Resolver404, e: tried.extend([(pattern.regex.pattern + ' ' + t) for t in e.args[0]['tried']]) else: if sub_match: sub_match_dict = dict([(smart_str(k), v) for k, v in match.groupdict ().items()]) sub_match_dict.update (self.default_kwargs)? Local vars Variable Value match <_sre.SRE_Match object at 0x02140AA0> new_path u'' path u'/' pattern <RegexURLPattern index ^$> self <RegexURLResolver homedomain.urls ^/> sub_match None tried ['^admin/(.*)'] C:\Python25\lib\site-packages\django\core\urlresolvers.py in resolve if kwargs: args = () else: args = match.groups() # In both cases, pass any extra_kwargs as **kwargs. kwargs.update (self.default_args) return self.callback, args, kwargs ... def _get_callback(self): if self._callback is not None: return self._callback try: self._callback = get_callable(self._callback_str)? Local vars Variable Value args () kwargs {} match <_sre.SRE_Match object at 0x022FA330> path u'' self <RegexURLPattern index ^$> C:\Python25\lib\site-packages\django\core\urlresolvers.py in _get_callback def _get_callback(self): if self._callback is not None: return self._callback try: self._callback = get_callable(self._callback_str) except ImportError, e: mod_name, _ = get_mod_func (self._callback_str) raise ViewDoesNotExist, "Could not import %s. Error was: %s" % (mod_name, str(e)) ... except AttributeError, e: mod_name, func_name = get_mod_func (self._callback_str) raise ViewDoesNotExist, "Tried %s in module %s. Error was: %s" % (func_name, mod_name, str(e)) return self._callback callback = property(_get_callback)? Local vars Variable Value _ 'index' e ImportError('No module named views',) mod_name 'views' self <RegexURLPattern index ^$> Environment: Request Method: GET Request URL: http://www.domain.com/ Django Version: 1.0-final-SVN-unknown Python Version: 2.5.2 Installed Applications: ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', 'homedomain.product'] Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware') Traceback: File "C:\Python25\lib\site-packages\django\core\handlers\base.py" in get_response 77. request.path_info) File "C:\Python25\lib\site-packages\django\core\urlresolvers.py" in resolve 180. sub_match = pattern.resolve(new_path) File "C:\Python25\lib\site-packages\django\core\urlresolvers.py" in resolve 123. return self.callback, args, kwargs File "C:\Python25\lib\site-packages\django\core\urlresolvers.py" in _get_callback 132. raise ViewDoesNotExist, "Could not import %s. Error was: %s" % (mod_name, str(e)) Exception Type: ViewDoesNotExist at / Exception Value: Could not import views. Error was: No module named views **************************************************************** Here is my urls.py under project root. ************************************************** from django.conf.urls.defaults import * from django.conf import settings from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^admin/(.*)', admin.site.root), url(r'^$', 'views.index', name="index"), url(r'^news/', 'views.news', name="news"), url(r'^home/', include('home.urls')), ) ************************************************ It seems the root (/) page request can not reach the index function in the views.py under project root. Don't know why. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---