On Feb 5, 4:32 pm, Graham Dumpleton <[email protected]> wrote: > At the start of the WSGI script file, add: > > import django > print django.__file__ > > In other words, work out whether top level 'django' can be installed > and if so where it is coming from. > > You might inadvertently have a django.py file sitting somewhere which > it is finding by mistake.
When I add that I get: [Mon Feb 06 06:36:57 2012] [error] [client 127.0.0.1] import django [Mon Feb 06 06:36:57 2012] [error] [client 127.0.0.1] ImportError: No module named django When I do the same from command like python I get: $ python Python 2.6.6 (r266:84292, Dec 7 2011, 20:38:36) [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import django >>> print django.__file__ /usr/lib/python2.6/site-packages/django/__init__.py When I print sys.path from my wsgi script /usr/lib/python2.6/site- packages is there. Does /usr/lib/python2.6/site-packages/django need to be given somewhere? -larry > > Graham > > On 6 February 2012 09:46, [email protected] > > <[email protected]> wrote: > > I posted this to the django group a couple of days ago, but no one has > > been able to help me. > > > I am trying to deploy my django app on a newly setup CentOS box. I > > have successfully deployed it on ubuntu and on a Mac. > > > I get these errors in the apache error log: > > > [Sat Feb 04 17:43:28 2012] [error] [client 127.0.0.1] mod_wsgi > > (pid=13616): Target WSGI script '/usr/local/myapp/scripts/myapp.wsgi' > > cannot be loaded as Python module. > > [Sat Feb 04 17:43:28 2012] [error] [client 127.0.0.1] mod_wsgi > > (pid=13616): Exception occurred processing WSGI script '/usr/local/ > > myapp/scripts/myapp.wsgi'. > > [Sat Feb 04 17:43:28 2012] [error] [client 127.0.0.1] Traceback (most > > recent call last): > > [Sat Feb 04 17:43:28 2012] [error] [client 127.0.0.1] File "/usr/ > > local/myapp/scripts/myapp.wsgi", line 8, in <module> > > [Sat Feb 04 17:43:28 2012] [error] [client 127.0.0.1] import > > django.core.handlers.wsgi > > [Sat Feb 04 17:43:28 2012] [error] [client 127.0.0.1] ImportError: No > > module named django.core.handlers.wsgi > > > From command line python the import works: > > > $ python > > Python 2.6.6 (r266:84292, Dec 7 2011, 20:38:36) > > [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2 > > Type "help", "copyright", "credits" or "license" for more information. > > myapp.wsgi > >>>> import django.core.handlers.wsgi > > > I also have this warning in the apache log: > > > [Sat Feb 04 17:41:12 2012] [warn] mod_wsgi: Compiled for Python/2.6.2. > > [Sat Feb 04 17:41:12 2012] [warn] mod_wsgi: Runtime using Python/ > > 2.6.6. > > > I've checked permissions, and wsgi.py and every dir in the path to it > > is 755. > > > $ ls -l /usr/lib/python2.6/site-packages/django/core/handlers// > > wsgi.py > > -rw-r--r--. 1 root root 9683 Feb 3 07:09 /usr/lib/python2.6/site- > > packages/django/core/handlers//wsgi.py > > > I have this line in my httpd.conf file: > > > WSGIScriptAlias / /usr/local/myapp/scripts/myapp.wsgi > > > I printed print sys.path from within my myapp.wsgi script, and it's > > the same as what I get from command line python: > > > ['/usr/lib/python2.6/site-packages/python_dateutil-1.5-py2.6.egg', '/ > > usr/lib/python26.zip', '/usr/lib/python2.6', '/usr/lib/python2.6/plat- > > linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/ > > usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/site-packages', '/ > > usr/lib/python2.6/site-packages/gst-0.10', '/usr/lib/python2.6/site- > > packages/gtk-2.0', '/usr/lib/python2.6/site-packages/ > > setuptools-0.6c11- > > py2.6.egg-info', '/usr/lib/python2.6/site-packages/webkit-1.0'] > > > django was installed from svn like this: > > > #svn cohttp://code.djangoproject.com/svn/django/trunk/django/usr/ > > lib/python2.6/dist-packages/django > > #ln -s /usrl/lib/python2.6/dist-packages/django /usr/lib/python2.6/ > > site-packages/django > > > Which is the same way I've done it on the other systems I've deployed > > this app on. > > > mod_wsgi was installed with yum. > > > Can anyone help me? > > > TIA! > > -larry > > > -- > > 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.
