Hi Graham, Thanks for the help. However the problem still occurs even though I added the line in the script.
Young On Dec 26, 5:44 pm, Graham Dumpleton <[email protected]> wrote: > At the start of the WSGI script file add: > > import sphene.community > > Does that work and then cause latter problem to go away or does it fail. > > Graham > > On 25 December 2010 00:23, Young <[email protected]> wrote: > > > > > > > > > Hi, > > > I've been configuring mod-wsgi for days but with no luck. My site runs > > well on Django dev server but doesn't work on Apache/mod_wsgi. I read > > Graham's nice blog post and it was very helpful to understand how > > Django dev server internally works. However it couldn't help to solve > > my problem as mine is somewhat complicated. > > > My site consists of 3 parts: my app, SCT app(wiki/forum, > >http://sct.sphene.net/wiki/show/Start/) and jpype module. Though my > > code solely runs well on Apache/mod_wsgi but it doesn't with other > > modules. > > > As my site runs well on Django dev server and both errors below are > > something like "class/module not found", I guess the error is related > > with path problems. However when I printed sys.path, it contained both > > '/dfs/mysite' and '/dfs'. > > > Any comments will be appreciated. Thanks in advance and Merry > > Christmas:) > > > -Young > > > My machine is: > > ############################################################### > > - Ubuntu server 10.10 64bit > > - Using DFS > > - Python 2.6.6 > > - Django 1.2.3 > > - mod_wsgi 3.3 > > > Simplified directory structure is: > > ################################################# > > /dfs/mysite/myapp : directory for my app > > /dfs/mysite/apache : directory for mod_wsgi script > > /dfs/mysite/sphene : director for SCT app > > /dfs/mysite/build/classes/com/mysite/myjava/Abc.Class : directory for > > JAVA class running on jpype > > > /etc/apache2/httpd.conf is: > > ##################################################### > > Alias /site_media/ /dfs/mysite/site_media/ > > <Directory /dfs/mysite/site_media> > > Order deny,allow > > Allow from all > > </Directory> > > > LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so > > WSGIScriptAlias / /dfs/mysite/apache/django.wsgi > > <Directory /dfs/mysite/apache> > > Order deny,allow > > Allow from all > > </Directory> > > > /dfs/mysite/apache/django.wsgi is: > > ############################################### > > import sys > > path1 = '/dfs' > > if path1 not in sys.path: > > sys.path.append(path1) > > path2 = '/dfs/mysite' > > if path2 not in sys.path: > > sys.path.append(path2) > > > import settings > > import django.core.management > > django.core.management.setup_environ(settings) > > utility = django.core.management.ManagementUtility() > > command = utility.fetch_command('runserver') > > command.validate() > > > import django.conf > > import django.utils > > django.utils.translation.activate(django.conf.settings.LANGUAGE_CODE) > > > import django.core.handlers.wsgi > > application = django.core.handlers.wsgi.WSGIHandler() > > > Jpype error is: > > ################################################################ > > java.lang.ExceptionPyRaisable at /service/abc/ > > java.lang.Exception: Class com.mysite.myjava.Abc not found > > > The Apache error.log is: > > ######################################################### > > [Fri Dec 24 04:25:59 2010] [notice] Apache/2.2.16 (Ubuntu) mod_wsgi/ > > 3.3 Python/2.6.6 configured -- resuming normal operations > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] mod_wsgi > > (pid=6180): Target WSGI script '/dfs/mysite/apache/django.wsgi' cannot > > be loaded as Python module. > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] mod_wsgi > > (pid=6180): Exception occurred processing WSGI script '/dfs/mysite/ > > apache/django.wsgi'. > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] Traceback > > (most recent call last): > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] File "/dfs/ > > mysite/apache/django.wsgi", line 18, in <module> > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] > > command.validate() > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] File "/usr/ > > local/lib/python2.6/dist-packages/django/core/management/base.py", > > line 249, in validate > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] > > num_errors = get_validation_errors(s, app) > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] File "/usr/ > > local/lib/python2.6/dist-packages/django/core/management/ > > validation.py", line 28, in get_validation_errors > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] for > > (app_name, error) in get_app_errors().items(): > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] File "/usr/ > > local/lib/python2.6/dist-packages/django/db/models/loading.py", line > > 146, in get_app_errors > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] > > self._populate() > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] File "/usr/ > > local/lib/python2.6/dist-packages/django/db/models/loading.py", line > > 61, in _populate > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] > > self.load_app(app_name, True) > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] File "/usr/ > > local/lib/python2.6/dist-packages/django/db/models/loading.py", line > > 76, in load_app > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] > > app_module = import_module(app_name) > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] File "/usr/ > > local/lib/python2.6/dist-packages/django/utils/importlib.py", line 35, > > in import_module > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] > > __import__(name) > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] ImportError: > > No module named sphene.community > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] mod_wsgi > > (pid=6181): Target WSGI script '/dfs/mysite/apache/django.wsgi' cannot > > be loaded as Python module. > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] mod_wsgi > > (pid=6181): Exception occurred processing WSGI script '/dfs/mysite/ > > apache/django.wsgi'. > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] Traceback > > (most recent call last): > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] File "/dfs/ > > mysite/apache/django.wsgi", line 18, in <module> > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] > > command.validate() > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] File "/usr/ > > local/lib/python2.6/dist-packages/django/core/management/base.py", > > line 249, in validate > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] > > num_errors = get_validation_errors(s, app) > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] File "/usr/ > > local/lib/python2.6/dist-packages/django/core/management/ > > validation.py", line 28, in get_validation_errors > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] for > > (app_name, error) in get_app_errors().items(): > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] File "/usr/ > > local/lib/python2.6/dist-packages/django/db/models/loading.py", line > > 146, in get_app_errors > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] > > self._populate() > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] File "/usr/ > > local/lib/python2.6/dist-packages/django/db/models/loading.py", line > > 61, in _populate > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] > > self.load_app(app_name, True) > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] File "/usr/ > > local/lib/python2.6/dist-packages/django/db/models/loading.py", line > > 76, in load_app > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] > > app_module = import_module(app_name) > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] File "/usr/ > > local/lib/python2.6/dist-packages/django/utils/importlib.py", line 35, > > in import_module > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] > > __import__(name) > > [Fri Dec 24 12:26:10 2010] [error] [client 76.169.74.121] ImportError: > > No module named sphene.community > > > -- > > You received this message because you are subscribed to the Google Groups > > "modwsgi" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group > > athttp://groups.google.com/group/modwsgi?hl=en. -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
