Yes, I did. Now that you mention it, I am not sure why I felt I needed to do that. ... Something must have prompted me to do it, but I cannot remember now. It must have had something to do with seeing the following example line:
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.apache.settings_production' ... And then misinterpreting/misreading the example lines on the mod_wsgi page for IntegrationWithDjango: sys.path.append('/usr/local/django') sys.path.append('/usr/local/django/mysite') So, looks like I was being more daft than I originally thought. Note to self (and anybody else who ever finds themselves being equally daft): there is no reason to put the ./apache/ directory in the sys.path; only a need to make sure it can get there if needed, by providing the ./apache/__init__.py file (if wanting to import a production settings/urls file from ./apache/) Thanks for continuing to work through it-- I was clearly burned out yesterday, and my troubles were self-created! Tim On Tue, Mar 31, 2009 at 5:28 PM, Graham Dumpleton < graham.dumple...@gmail.com> wrote: > > 2009/4/1 Tim Valenta <tonightslasts...@gmail.com>: > > Yes, the file path was mysite/apache/django.wsgi . I was getting > unhelpful > > server-500 errors when loading apache (which I haven't fully resolved > yet-- > > will try tonight), so I was trying to run the .wsgi file all by itself, > to > > confirm that nothing was amiss in the Python code itself. > > Thus I had renamed it to mysite/apache/django.py and was just executing > it > > for testing. Within that code, I was saying "django.core.....", which > would > > circling back on itself, since the first directory checked would have > been > > its own executing directory. > > I have a settings_production.py file in the same ./apache/ directory, but > as > > of yet, it's not in use. > > The only thing in the 'apache' subdirectory should be the WSGI script > file, and you should not be adding that directory to sys.path. I can't > see at the moment how calling it django.py could have caused a problem > as long as you hadn't added that directory to sys.path. > > So, had you added the 'apache' directory to sys.path? > > Graham > > > On Tue, Mar 31, 2009 at 4:56 PM, Graham Dumpleton > > <graham.dumple...@gmail.com> wrote: > >> > >> Where have you put the WSGI script file? If it was put in an 'apache' > >> subdirectory, as the documentation indicates, instead of same > >> directory as the settings.py file you shouldn't have this problem. > >> > >> 2009/4/1 Tim Valenta <tonightslasts...@gmail.com>: > >> > Hello Graham-- Late last night before falling asleep I realized that > >> > this > >> > could be the only explanation, and suddenly realized that-- in fact-- > >> > the > >> > very .wsgi file I wanted to test was called "django.wsgi", which I had > >> > renamed to "django.py" for something of a unit-test. Therefore, my > >> > import > >> > was finding itself first, no matter where I was running the lone file. > >> > Ultimately the issue was me being daft :) About 10 minutes ago before > >> > leaving the house this morning, I turned on the monitor and renamed > the > >> > file > >> > and tested again, and it worked without any of the above mentioned > >> > issues. > >> > Thanks for the reply. > >> > Tim > >> > > >> > On Mon, Mar 30, 2009 at 11:44 PM, Graham Dumpleton > >> > <graham.dumple...@gmail.com> wrote: > >> >> > >> >> 2009/3/31 Tim Valenta <tonightslasts...@gmail.com>: > >> >> > Hello all-- > >> >> > > >> >> > I've been casually trying to get mod_wsgi working in a Ubuntu 8.10 > >> >> > sever, to > >> >> > run even the simplest of Django test projects. So far, I've had no > >> >> > dice > >> >> > getting the example Django wsgi scripts to work. > >> >> > > >> >> > Most simply, I'm having an import error, which is baffling me > beyond > >> >> > my > >> >> > sanity. I've examined both the docs found on the mod_wsgi site, > and > >> >> > also on > >> >> > Django's wiki system (found here: > >> >> > http://code.djangoproject.com/wiki/django_apache_and_mod_wsgi ). > >> >> > > >> >> > Currently, I've been following the latter docs, as they seemed more > >> >> > comprehensive from start to finish. > >> >> > > >> >> > No matter what I append to the sys.path variable in the example > >> >> > '.wsgi' > >> >> > file, I cannot import django.core.handlers.wsgi. I get a "No > module > >> >> > named > >> >> > core.handlers.wsgi" ImportError. Running python from within the > root > >> >> > SVN > >> >> > checkout of django, this import works wonderfully. Elsewhere, not > >> >> > so. > >> >> > > >> >> > This might be more of a Python question than a mod_wsgi or django > >> >> > question, > >> >> > but am I wrong to assume that doing > >> >> > sys.path.append("/home/rydia/django") > >> >> > (where my svn checkout lives) should put that on my PythonPath, for > >> >> > proper > >> >> > module imports? > >> >> > > >> >> > Perhaps I'm just missing something very basic, but my head has had > it > >> >> > today > >> >> > with more projects than I can handle :P > >> >> > Quick notes: apache itself runs great, aliases to my media > directory > >> >> > works > >> >> > great, though I can't verify any success in the whole mod_wsgi > >> >> > department. > >> >> > >> >> Note the following: > >> >> > >> >> $ python > >> >> Python 2.3.5 (#1, Jan 12 2009, 14:43:55) > >> >> [GCC 3.3 20030304 (Apple Computer, Inc. build 1819)] on darwin > >> >> Type "help", "copyright", "credits" or "license" for more > information. > >> >> >>> import a.b > >> >> Traceback (most recent call last): > >> >> File "<stdin>", line 1, in ? > >> >> ImportError: No module named a.b > >> >> >>> import os > >> >> >>> import os.c.d > >> >> Traceback (most recent call last): > >> >> File "<stdin>", line 1, in ? > >> >> ImportError: No module named c.d > >> >> > >> >> If you import a module where top level module doesn't exist, the > >> >> ImportError, shows the full dotted path. > >> >> > >> >> If however you import a module where the top level module does exist, > >> >> but the sub modules don't, then only the missing sub modules are > >> >> listed in the ImportError. > >> >> > >> >> In your case the error says "No module named core.handlers.wsgi". > This > >> >> means that the 'django' top level module was found, but that there > >> >> were no sub modules of the names requested in it. > >> >> > >> >> What is likely therefore happening is one of a few things. > >> >> > >> >> 1. You are running Apache such that code runs as Apache user and > >> >> although that user has access to top level 'django' package > directory, > >> >> it doesn't have permissions to read sub modules. > >> >> > >> >> 2. You have a file based module called 'django.py' somewhere on your > >> >> path and it is finding that first. That or it is a directory called > >> >> 'django' and it has in it a '__init__.py' file. > >> >> > >> >> What I suggest you do is add the following to the start of your .wsgi > >> >> script file. > >> >> > >> >> import sys > >> >> import django > >> >> > >> >> print >> sys.stderr, 'django __file__', django.__file__ > >> >> > >> >> Look at the Apache error log to see where that 'django' top level > >> >> module is being picked up from. See if that is the one you expect. > See > >> >> if everything looks to have correct permissions. See if it might > >> >> actually be some file module called 'django.py' or empty 'django' > >> >> package directory. > >> >> > >> >> Post results as would be curious to know so can add this to the mind > >> >> back of problems that come up. > >> >> > >> >> Graham > >> >> > >> >> > >> > > >> > > >> > > >> > -- > >> > "Python is the unholy bastard step-child between Ruby and PHP." > >> > "I'd let an ipod blow up on my leg for $150,000." > >> > "but Ben and Jerry do make a lovely couple." > >> > > >> > > > >> > > >> > >> > > > > > > > > -- > > "Python is the unholy bastard step-child between Ruby and PHP." > > "I'd let an ipod blow up on my leg for $150,000." > > "but Ben and Jerry do make a lovely couple." > > > > > > > > > > > -- "Python is the unholy bastard step-child between Ruby and PHP." "I'd let an ipod blow up on my leg for $150,000." "but Ben and Jerry do make a lovely couple." --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to modwsgi@googlegroups.com To unsubscribe from this group, send email to modwsgi+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en -~----------~----~----~----~------~----~------~--~---