It looks like I may have this working now.  It appears that something
was being cached.  So I deleted the settings.pyc and rebooted the
server and it seems to work with wsgi on apache.  I guess it helps to
not give up ;)

Thanks for all of your help...

On May 12, 11:58 pm, Graham Dumpleton <[email protected]>
wrote:
> That I can't help with too much.
>
> BTW, if you are using embedded mode of mod_wsgi and not daemon mode,
> and you were doing a complete stop/start of Apache, that may explain
> why stuff was working when WSGI script sys.path wasn't what expected.
> That is, in embedded mode, if you change WSGI script, just the WSGI
> script file is reloaded and not the whole process. Thus multiple
> changes to sys.path will accumulate across the changes. Read:
>
> http://code.google.com/p/modwsgi/wiki/ReloadingSourceCode#Reloading_I...
>
> Recommend you use daemon mode if you aren't already.
>
> http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide#Delegat...
>
> Of daemon mode the whole process is restarted automatically when WSGI
> script file changed. Read the full document about on source code
> reloading to get the whole story.
>
> Graham
>
> On 13 May 2011 13:20, Chuck <[email protected]> wrote:
>
> > I added that and now I just get the Django welcome screen.  Now what's
> > really weird is that even when I don't have apache running and I just
> > use the Django development server, I get the same page.  Now my
> > development server doesn't work.  I'm totally screwed.
>
> > On May 12, 10:39 pm, Graham Dumpleton <[email protected]>
> > wrote:
> >> On 13 May 2011 12:15, Chuck <[email protected]> wrote:
>
> >> > I feel pretty stupid here.  I just want to construct this django.wsgi
> >> > file.
>
> >> > I have a project at /home/charles/projects/python/firstdjango
>
> >> > This is where my settings.py lives...this is also where I decided to
> >> > put the django.wsgi file.
>
> >> > I also have references to views in my urls.py that point to a books
> >> > and contact subfolder underneath firstdjango.
>
> >> > I'm obviously doing something wrong here and I can't figure it out.
>
> >> > If you could be so generous...what would I do here?
>
> >> Use:
>
> >> import os
> >> import sys
>
> >> sys.path.insert(0, '/home/charles/projects/python')
> >> sys.path.insert(0, '/home/charles/projects/python/firstdjango')
>
> >> os.environ['DJANGO_SETTINGS_MODULE'] = 'firstdjango.settings'
>
> >> import django.core.handlers.wsgi
> >> application = django.core.handlers.wsgi.WSGIHandler()
>
> >> This what the example in:
>
> >>http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
>
> >> effectively says with just the paths different.
>
> >> Graham
>
> >> > On May 12, 9:55 pm, Graham Dumpleton <[email protected]>
> >> > wrote:
> >> >> On 13 May 2011 11:49, Chuck <[email protected]> wrote:
>
> >> >> > Ok, I modified the django.wsgi and instead put in the root of my app.
>
> >> >> > Here are the contents of the file:
>
> >> >> > import os
> >> >> > import sys
>
> >> >> > sys.path.insert(0, '/home/charles/projects/python/firstdjango')
>
> >> >> > os.environ['DJANGO_SETTINGS_MODULE'] = 'firstdjango.settings'
>
> >> >> > import django.core.handlers.wsgi
> >> >> > application = django.core.handlers.wsgi.WSGIHandler()
>
> >> >> > This does not give me an error.  It presents me with the Django
> >> >> > welcome page and tells me I haven't configured a database or anything
> >> >> > in my settings.  Obviously I have configured all of this stuff. I'm
> >> >> > not sure whether I'm getting closer or farther away from success.
>
> >> >> Which on first review shouldn't work, unless under:
>
> >> >> /home/charles/projects/python/firstdjango
>
> >> >> you have another directory called 'firstdjango' which is the actual
> >> >> Django site directory containing the 'settings.py' file.
>
> >> >> This is because 'firstdjango.settings' in Django settings module
> >> >> ultimately means that Python goes looking for a file called
> >> >> 'firstdjango/settings.py' underneath the directories which are listed
> >> >> in sys.path.
>
> >> >> Graham
>
> >> >> > On May 12, 9:13 pm, Graham Dumpleton <[email protected]>
> >> >> > wrote:
> >> >> >> On 13 May 2011 11:06, Chuck <[email protected]> wrote:
>
> >> >> >> > This is the content of my wsgi file in my Django project.
>
> >> >> >> > import os, sys
>
> >> >> >> > # path to directory of the .wsgi file ('apache/')
> >> >> >> > wsgi_dir = os.path.abspath(os.path.dirname(__file__))
>
> >> >> >> So the WSGI script file is in directory something like
> >> >> >> .../parent/firstdjango/apache directory.
>
> >> >> >> > # path to project root directory (parent of 'apache/')
> >> >> >> > project_dir = os.path.dirname(wsgi_dir)
>
> >> >> >> This give project_dir as '.../parent/firstdjango'.
>
> >> >> >> > # add project directory to system's PATH
> >> >> >> > sys.path.append(project_dir)
>
> >> >> >> You are only adding '.../parent/firstdjango' to sys.path.
>
> >> >> >> > # add the settings.py file to your system's PATH
> >> >> >> > project_settings = os.path.join(project_dir,'settings')
>
> >> >> >> > # explicitly define the DJANGO_SETTINGS_MODULE
> >> >> >> > os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
>
> >> >> >> > import django.core.handlers.wsgi
> >> >> >> > application = django.core.handlers.wsgi.WSGIHandler()
>
> >> >> >> > I only have one settings file,which is named settings.py.
>
> >> >> >> > Now it's giving me an error about not finding TemplateSyntaxError:
> >> >> >> > Caught ImportError while rendering: No module named 
> >> >> >> > firstdjango.books
>
> >> >> >> Which fails, because '.../parent' is not in sys.path.
>
> >> >> >> You would also need:
>
> >> >> >>   sys.path.append(os.dirname(project_dir))
>
> >> >> >> else it can't find 'firstdjango' in sys.path when search for project
> >> >> >> package root.
>
> >> >> >> For additional reading on the sys.path mess that Django has got 
> >> >> >> itself
> >> >> >> into read:
>
> >> >> >>  http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html
>
> >> >> >> Graham
>
> >> >> >> > I have a project under my main app called books.  The project is
> >> >> >> > called firstdjango.
>
> >> >> >> > I'll look at your post about permissions.
>
> >> >> >> > On May 12, 8:52 pm, Graham Dumpleton <[email protected]>
> >> >> >> > wrote:
> >> >> >> >> Quickest answer is for me to say go watch:
>
> >> >> >> >>  http://code.google.com/p/modwsgi/wiki/WhereToGetHelp?tm=6#Conference_...
>
> >> >> >> >> In that presentation I step through sys.path issues as well as
> >> >> >> >> permission issues.
>
> >> >> >> >> Also ensure you have also read:
>
> >> >> >> >>  http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
>
> >> >> >> >> taking note of what it says about sys.path.
>
> >> >> >> >> Graham
>
> >> >> >> >> On 13 May 2011 10:40, Chuck <[email protected]> wrote:
>
> >> >> >> >> > It looks like the mod_wsgi module is getting loaded.  Now the 
> >> >> >> >> > problem
> >> >> >> >> > seems to exist in my django.wsgi script within my Django app. 
> >> >> >> >> > When
> >> >> >> >> > looking at the Apache error log I am seeing this:
>
> >> >> >> >> > Exception occurred processing WSGI script
>
> >> >> >> >> > ImportError: Could not import settings 'firstdjango.settings' 
> >> >> >> >> > (Is it
> >> >> >> >> > on sys.path? Does it have syntax errors?): No module named
> >> >> >> >> > firstdjango.settings
>
> >> >> >> >> > On May 12, 8:27 pm, Graham Dumpleton 
> >> >> >> >> > <[email protected]>
> >> >> >> >> > wrote:
> >> >> >> >> >> On 13 May 2011 10:25, Chuck <[email protected]> wrote:
>
> >> >> >> >> >> > Doing some research in other posts...I have at least gotten 
> >> >> >> >> >> > further
> >> >> >> >> >> > along.  I had to figure out a way to include the mod_wsgi 
> >> >> >> >> >> > module in
> >> >> >> >> >> > the Apache modules.  So I did this:
>
> >> >> >> >> >> > Solution – enable mod_wsgi on SuSE linux
>
> >> >> >> >> >> >   1. Edit the file /etc/sysconfig/apache2 as root:
> >> >> >> >> >> >         1. search for APACHE_MODULES, you should find a line 
> >> >> >> >> >> > like
> >> >> >> >> >> > this
> >> >> >> >> >> >            APACHE_MODULES="suexec access actions alias auth 
> >> >> >> >> >> > auth_dbm
> >> >> >> >> >> > autoindex cgi dir env expires include log_config mime 
> >> >> >> >> >> > negotiation
> >> >> >> >> >> > setenvif userdir ssl php4"
> >> >> >> >> >> >         2. Add wsgi to the content in the list between the “
> >> >> >> >> >> >         3. Save the changes and quit
> >> >> >> >> >> >   2. run SuSEconfig to update the apache configuration files
> >> >> >> >> >> >   3. run /etc/init.d/apache2 restart to restart the Apache 
> >> >> >> >> >> > server
>
> >> >> >> >> >> Thanks for that. I didn't know that SuSE was so weird when it 
> >> >> >> >> >> came to
> >> >> >> >> >> enabling of the modules.
>
> >> >> >> >> >> Graham
>
> >> >> >> >> >> > Verify that the mod_wsgi module is installed correctly
>
> >> >> >> >> >> > /usr/sbin/httpd2 -M
> >> >> >> >> >> > Loaded Modules:
> >> >> >> >> >> >  core_module (static)
> >> >> >> >> >> >  mpm_prefork_module (static)
> >> >> >> >> >> >  http_module (static)
> >> >> >> >> >> >  so_module (static)
> >> >> >> >> >> >  actions_module (shared)
> >> >> >> >> >> >  alias_module (shared)
> >> >> >> >> >> >  auth_basic_module (shared)
> >> >> >> >> >> >  authn_file_module (shared)
> >> >> >> >> >> >  authz_host_module (shared)
> >> >> >> >> >> >  authz_groupfile_module (shared)
> >> >> >> >> >> >  authz_default_module (shared)
> >> >> >> >> >> >  authz_user_module (shared)
> >> >> >> >> >> >  autoindex_module (shared)
> >> >> >> >> >> >  cgi_module (shared)
> >> >> >> >> >> >  dir_module (shared)
> >> >> >> >> >> >  env_module (shared)
> >> >> >> >> >> >  expires_module (shared)
> >> >> >> >> >> >  include_module (shared)
> >> >> >> >> >> >  log_config_module (shared)
> >> >> >> >> >> >  mime_module (shared)
> >> >> >> >> >> >  negotiation_module (shared)
> >> >> >> >> >> >  setenvif_module (shared)
> >> >> >> >> >> >  ssl_module (shared)
> >> >> >> >> >> >  userdir_module (shared)
> >> >> >> >> >> >  wsgi_module (shared)
> >> >> >> >> >> > Syntax OK
>
> >> >> >> >> >> > When I restart Apache it's not giving me an error anymore.  
> >> >> >> >> >> > I'll post
> >> >> >> >> >> > more info as I go.
>
> >> >> >> >> >> > On May 12, 8:00 pm, Chuck <[email protected]> wrote:
> >> >> >> >> >> >> I'm sorry if this is a pain to answer this question because 
> >> >> >> >> >> >> it
> >> >> >> >> >> >> probably is the "stock" newbie whine.
>
> >> >> >> >> >> >> I'm getting the ubiquitous Invalid command 
> >> >> >> >> >> >> 'WSGIScriptAlias', perhaps
> >> >> >> >> >> >> misspelled or defined by a
>
> ...
>
> read more »

-- 
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.

Reply via email to