2008/9/17 MilesTogoe <[EMAIL PROTECTED]>:
>>>>>>> on the local development server using a manage.py file, this works:
>>>>>>>
>>>>>>> from app import utils
>>>>>>> from app.application import App
>>>>>>>
>>>>>>> assuming folder structure like:
>>>>>>> project
>>>>>>>  manage.py
>>>>>>>  app
>>>>>>>    utils.py
>>>>>>>    application.py
>>>>>>>
>>>>>>> but in .wsgi file it does not work
>>>>>>> from app import utils  ==> error: no module app
> ...
>>>>>> Thus, better to create an 'apache' subdirectory below where manage.py
>>>>>> is and only expose that directory through Apache. In that subdirectory
>>>>>> then create a .wsgi file which contains something like:
>>>>>>
>>>>>>   import os, sys
>>>>>>
>>>>>>   PARENT = os.path.join(os.path.dirname(__file__), '..')
>>>>>>   sys.path.append(PARENT)
>>>>>>   from app import utils
>>>>>>   from app.application import App
>>>>>>
>>>>>>
>>>>>>
>
> ...
>
> okay but I don't see how this is helping me figure out what the server
> is returning when in my wsgi file I'm calling out:
>
> PROJECT_PATH = os.path.dirname(os.path.join(os.path.dirname(__file__),
> '..'))
> sys.path.append(PROJECT_PATH)
>
> (in this case the project dir is 2 levels up from the wsgi script)
> somehow the server is not finding the app in the project dir
>

You have modified that from what I said to do and use.

What I said to do would have yielded.

project
   manage.py
   apache
      dispatch.wsgi
   app
      utils.py
      application.py

Where dispatch.wsgi had:

 import os, sys

 PARENT = os.path.join(os.path.dirname(__file__), '..')
 sys.path.append(PARENT)

 from app import utils
 from app.application import App

You have added another dirname() which means it effectively has a path
of 'some/path/project/apache' still rather than just
'/some/path/project'. In other words you are one directory to low in
hierarchy from what I can see.

In your WSGI script file add:

  print >> sys.stderr, 'PARENT %s' % PARENT

and then look in Apache error log file to see what it is getting set
to and it may help.

You can also test it in interactive Python.

What you have:

>>>os.path.dirname(os.path.join(os.path.dirname('/some/path/project/apache/dispatch.wsgi'),
>>> '..'))
'/some/path/project/apache'

What I said to use:

>>>os.path.join(os.path.dirname('/some/path/project/apache/dispatch.wsgi'), 
>>>'..')
'/some/path/project/apache/..'

Which normalises to:

>>>os.path.normpath(os.path.join(os.path.dirname('/some/path/project/apache/dispatch.wsgi'),'..'))
'/some/path/project'

Graham

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to