Ubiquitous is probably not the right word as this doesn't come up often.
In short, it means that the line:
LoadModule wsgi_module modules/mod_wsgi.so
(where the path argument may be different for your installation), has
been added to Apache configuration, or if it is in a Apache
configuration file snippet file for the module, eg., wsgi.load, that
that module hasn't been enabled using the appropriate distributions
script for enabling Apache modules.
So, can you find a LoadModule line for wsgi_module anywhere in your
Apache configuration files?
Graham
> --
> You received this message because you are subscribed to the Google Groups "modwsgi" group.
> To post to this group, send email to mod...@googlegroups.com.
> To unsubscribe from this group, send email to modwsgi+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
>
>
Thanks for that. I didn't know that SuSE was so weird when it came to
enabling of the modules.
Graham
http://code.google.com/p/modwsgi/wiki/WhereToGetHelp?tm=6#Conference_Presentations
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
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
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
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.
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_In_Embedded_Mode
Recommend you use daemon mode if you aren't already.
http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide#Delegation_To_Daemon_Process
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
Graham