Thanks Graham,
That helped. What I wanted to do is to have apache server the static
content only to signed in users. The static content is in
/var/www/django/static, so I did this in httpd.conf
#Set up django and mod_wsgi
#Set up access control for the static content. See
code.google.com/p/mdowsgi/wiki/AccessControlMechanisms by Graham Dumbleton
<AuthnProviderAlias wsgi django>
WSGIAuthUserScript /var/www/django/mysite/apache/auth.wsgi
application-group=django
</AuthnProviderAlias>
#Set up the WSGI script alias file
WSGIScriptAlias / /var/www/django/mysite/apache/django.wsgi
#Allow access to wsgi directory for apache
<Directory /var/www/django/mysite/apache/mysite>
Order allow,deny
Allow from all
</Directory>
#Use apache to serve content from the static files
Alias /static/ /var/www/django/static/
#Set up access control for the static directory, and get the user
authentication from wsgi
<Directory /var/www/django/static>
Order deny,allow
Allow from all
WSGIApplicationGroup django
AuthType Basic
AuthName "Django Site"
AuthBasicProvider django
Require valid-user
</Directory>
Works! The user has to renter his password the first time he hits static
content, but then the browser saves it so that's fine. Thanks again for
the coaching!
Harry
On Tuesday, August 28, 2012 9:24:22 PM UTC-4, Graham Dumpleton wrote:
>
> Don't you mean:
>
> WSGIScriptAlias /myapp /var/www/wsgi-scripts/myapp/wsgi.py
>
> You have to modify the target file based on where it is. Can't copy
> documentation blindly.
>
> Graham
>
> On 29 August 2012 10:59, hhummel <[email protected] <javascript:>> wrote:
> > I'm having trouble with getting mod_wsgi going on FC15 linux. I'm
> trying to run the simple "Hello World" demo.
> >
> > Here's httpd.conf:
> >
> > LoadModule wsgi_module modules/mod_wsgi.so
> >
> > WSGIScriptAlias /myapp /var/www/wsgi-scripts/myapp.wsgi
> >
> > <Directory /var/www/wsgi-scripts>
> > Order allow,deny
> > Allow from all
> > </Directory>
> >
> > The app is in /var/www/wsgi-scripts/myapp/wsgi.py, and is copied
> directly from the documentation:
> >
> > def application(environ, start_response):
> > status = '200 OK'
> > output = 'Hello World!'
> >
> > response_headers = [('Content-type', 'text/plain'),
> > ('Content-Length', str(len(output)))]
> > start_response(status, response_headers)
> >
> > return [output]
> >
> > When I restart the server and use the URL 127.0.0.1/mapp is see this
> error log:
> >
> > [Tue Aug 28 20:44:26 2012] [notice] Apache/2.2.22 (Unix) DAV/2
> mod_python/3.3.1 Python/2.7.1 mod_wsgi/3.4 PHP/5.3.13 mod_ssl/2.2.22
> OpenSSL/1.0.0j-fips mod_perl/2.0.4 Perl/v5.12.4 configured -- resuming
> normal operations
> > [Tue Aug 28 20:44:26 2012] [info] Server built: Feb 13 2012 14:50:23
> > [Tue Aug 28 20:44:26 2012] [info] mod_wsgi (pid=556): Attach interpreter
> ''.
> > [Tue Aug 28 20:44:26 2012] [info] mod_wsgi (pid=555): Attach interpreter
> ''.
> > [Tue Aug 28 20:44:32 2012] [error] [client 127.0.0.1] Target WSGI script
> not found or unable to stat: /var/www/wsgi-scripts/myapp.wsgi
> >
> > Permissions on the file:
> > [harry@mars mysite]$ ls -l
> > total 4
> > -rw-r--r-- 1 harry harry 1428 Aug 28 17:21 wsgi.py
> >
> > Permissions on the dir:
> > [harry@mars apache]$ ls -l
> > total 4
> > drwxrwxr-x 2 harry harry 4096 Aug 28 18:25 mysite
> >
> > I'm kind of stuck what else to try. Can you help?
> >
> > Many thanks,
> >
> > Harry
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "modwsgi" group.
> > To view this discussion on the web visit
> https://groups.google.com/d/msg/modwsgi/-/G98EjEg88ZUJ.
> > To post to this group, send email to [email protected]<javascript:>.
>
> > To unsubscribe from this group, send email to
> [email protected] <javascript:>.
> > For more options, visit this group at
> http://groups.google.com/group/modwsgi?hl=en.
> >
>
--
You received this message because you are subscribed to the Google Groups
"modwsgi" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/modwsgi/-/nX4xJxe9eJkJ.
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.