Re: mod_wsgi+apache2.2+django1+WindowsXP: can't serve images

2009-02-17 Thread Graham Dumpleton



On Feb 17, 5:20 am, Angel Cruz  wrote:
> Thank you Graham!  All of my reference materials, including the Django book
> I am currently reading (mod_wsgi was toward the end of the book and I should
> have looked there first :>) ), has the "Alias" directive.  Why I typed Match
> in there, I am now at a lost :>)
> Off I gothank you again!

Which Django book are you reading? Am not aware of any Django book in
print which really even mentions mod_wsgi, except maybe in passing.
All that I have seen concentrate on mod_python.

Graham

> On Sun, Feb 15, 2009 at 4:11 PM, Graham Dumpleton <
>
> graham.dumple...@gmail.com> wrote:
>
> > On Feb 16, 10:19 am, MrBodjangles  wrote:
> > > I am going thru the sample blog application introduced in the book
> > > "Python Web Development with Django (covers Django 1.0)".
>
> > > Before getting too deep into the book, I decided I wanted to first
> > > ensure that the application will render in apache since I want to
> > > include an image at the bottom of the blog posts (I have been hacking
> > > spaghetti code in php for a couple of years now, but now, am intent on
> > > coding neatly with python).
>
> > > The blog application works partially in that apache renders the text
> > > contents, but not the image.
>
> > > Note the access.log contents in the end ( "GET /media/img/
> > > people_rose.jpg HTTP/1.1" 404 2001)
>
> > > I have read so much good stuff about Django that I want to dive into
> > > it full speed ahead, but now I am stuck in serving a simple image.
>
> > > Help?
>
> > > --
> > > httpd.conf:
> > > ===
> > > .
> > > .
> > > .
> > > 
> > > # I will put this later in a separe conf file
> > > ###
> > > # This did not work ==>>>  AliasMatch ^/([^/]+)/media/(.*) "c:/my_wsgi/
> > > media"
> > > #
> > > # trying AliasMatch below...still does not work :>(
> > > #
>
> > > AliasMatch ^media/(.*) "c:/my_wsgi/media/"
>
> > Use Alias directive, not AliasMatch, as described in mod_wsgi
> > documentation. See:
>
> >  http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
>
> > Perform direct URL accesses against stuff in media directory to
> > ascertain if working or not.
>
> > > 
> > > Order allow,deny
> > > Options Indexes
> > > Allow from all
> > > IndexOptions FancyIndexing
> > > 
>
> > > WSGIScriptAliasMatch ^/([^/]+) "c:/my_wsgi/apache/django.wsgi"
>
> > Again, read the documentation. Do not use WSGIScriptAliasMatch, use
> > WSGIScriptAlias.
>
> > Why are you using the Match variants? Where did you get the idea you
> > had to do that?
>
> > Try what is in the documentation instead.
>
> > Graham
>
> > > 
> > > Order deny,allow
> > > Allow from all
> > > 
> > > 
>
> > > #
> > > # DirectoryIndex: sets the file that Apache will serve if a directory
> > > # is requested.
> > > .
> > > .
> > > .
>
> > > 
> > > django.wsgi:
> > > 
> > > import os, sys
>
> > > #Calculate the path based on the location of the WSGI script.
> > > apache_configuration= os.path.dirname(__file__)
> > > project = os.path.dirname(apache_configuration)
> > > workspace = os.path.dirname(project)
>
> > > sys.path.append(workspace)
> > > sys.path.append('c:\\my_wsgi')
>
> > > os.environ['DJANGO_SETTINGS_MODULE'] = 'blog.settings'
> > > import django.core.handlers.wsgi
> > > application = django.core.handlers.wsgi.WSGIHandler()
>
> > > 
> > > settings.py:
> > > 
> > > .
> > > .
> > > .
> > > # Absolute path to the directory that holds media.
> > > # Example: "/home/media/media.lawrence.com/"
> > > MEDIA_ROOT = ''
>
> > > # URL that handles the media served from MEDIA_ROOT. Make sure to use
> > > a
> > > # trailing slash if there is a path component (optional in other
> > > cases).
> > > # Examples: "http://media.lawrence.com";, "http://example.com/media/";
> > > MEDIA_URL = ''
>
> > > # URL prefix for admin media -- CSS, JavaScript and images. Make sure
> > > to use a
> > > # trailing slash.
> > > # Examples: "http://foo.com/media/";, "/media/".
> > > ADMIN_MEDIA_PREFIX = '/media/'
> > > .
> > > .
> > > .
>
> > > 
> > > base.html (lives in c:\my_wsgi\blog\templates):
> > > ==
> > > .
> > > .
> > > .
> > > 
> > > {%block content %}
> > > {%endblock%}
>
> > >  
> > >  > > height="848"> 
> > > .
> > > .
> > > .
>
> > > -
> > > access.log:
> > > =
> > > 127.0.0.1 - - [15/Feb/2009:15:05:41 -0800] "GET /blog/v_blog/ HTTP/
> > > 1.1" 200 565
> > > 127.0.0.1 - - [15/Feb/2009:15:05:43 -0800] "GET /media/img/
> > > people_rose.jpg HTTP/1.1" 404 2001
> > > 127.0.0.1 - - [15/Feb/2009:15:05:44 -0800] "GET /favicon.ico HTTP/1.1"
> > > 404 1944
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscrib

Re: mod_wsgi+apache2.2+django1+WindowsXP: can't serve images

2009-02-16 Thread Angel Cruz
Thank you Graham!  All of my reference materials, including the Django book
I am currently reading (mod_wsgi was toward the end of the book and I should
have looked there first :>) ), has the "Alias" directive.  Why I typed Match
in there, I am now at a lost :>)
Off I gothank you again!

On Sun, Feb 15, 2009 at 4:11 PM, Graham Dumpleton <
graham.dumple...@gmail.com> wrote:

>
>
>
> On Feb 16, 10:19 am, MrBodjangles  wrote:
> > I am going thru the sample blog application introduced in the book
> > "Python Web Development with Django (covers Django 1.0)".
> >
> > Before getting too deep into the book, I decided I wanted to first
> > ensure that the application will render in apache since I want to
> > include an image at the bottom of the blog posts (I have been hacking
> > spaghetti code in php for a couple of years now, but now, am intent on
> > coding neatly with python).
> >
> > The blog application works partially in that apache renders the text
> > contents, but not the image.
> >
> > Note the access.log contents in the end ( "GET /media/img/
> > people_rose.jpg HTTP/1.1" 404 2001)
> >
> > I have read so much good stuff about Django that I want to dive into
> > it full speed ahead, but now I am stuck in serving a simple image.
> >
> > Help?
> >
> > --
> > httpd.conf:
> > ===
> > .
> > .
> > .
> > 
> > # I will put this later in a separe conf file
> > ###
> > # This did not work ==>>>  AliasMatch ^/([^/]+)/media/(.*) "c:/my_wsgi/
> > media"
> > #
> > # trying AliasMatch below...still does not work :>(
> > #
> >
> > AliasMatch ^media/(.*) "c:/my_wsgi/media/"
>
> Use Alias directive, not AliasMatch, as described in mod_wsgi
> documentation. See:
>
>  http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
>
> Perform direct URL accesses against stuff in media directory to
> ascertain if working or not.
>
> > 
> > Order allow,deny
> > Options Indexes
> > Allow from all
> > IndexOptions FancyIndexing
> > 
> >
> > WSGIScriptAliasMatch ^/([^/]+) "c:/my_wsgi/apache/django.wsgi"
>
> Again, read the documentation. Do not use WSGIScriptAliasMatch, use
> WSGIScriptAlias.
>
> Why are you using the Match variants? Where did you get the idea you
> had to do that?
>
> Try what is in the documentation instead.
>
> Graham
>
> > 
> > Order deny,allow
> > Allow from all
> > 
> > 
> >
> > #
> > # DirectoryIndex: sets the file that Apache will serve if a directory
> > # is requested.
> > .
> > .
> > .
> >
> > 
> > django.wsgi:
> > 
> > import os, sys
> >
> > #Calculate the path based on the location of the WSGI script.
> > apache_configuration= os.path.dirname(__file__)
> > project = os.path.dirname(apache_configuration)
> > workspace = os.path.dirname(project)
> >
> > sys.path.append(workspace)
> > sys.path.append('c:\\my_wsgi')
> >
> > os.environ['DJANGO_SETTINGS_MODULE'] = 'blog.settings'
> > import django.core.handlers.wsgi
> > application = django.core.handlers.wsgi.WSGIHandler()
> >
> > 
> > settings.py:
> > 
> > .
> > .
> > .
> > # Absolute path to the directory that holds media.
> > # Example: "/home/media/media.lawrence.com/"
> > MEDIA_ROOT = ''
> >
> > # URL that handles the media served from MEDIA_ROOT. Make sure to use
> > a
> > # trailing slash if there is a path component (optional in other
> > cases).
> > # Examples: "http://media.lawrence.com";, "http://example.com/media/";
> > MEDIA_URL = ''
> >
> > # URL prefix for admin media -- CSS, JavaScript and images. Make sure
> > to use a
> > # trailing slash.
> > # Examples: "http://foo.com/media/";, "/media/".
> > ADMIN_MEDIA_PREFIX = '/media/'
> > .
> > .
> > .
> >
> > 
> > base.html (lives in c:\my_wsgi\blog\templates):
> > ==
> > .
> > .
> > .
> > 
> > {%block content %}
> > {%endblock%}
> >
> >  
> >  > height="848"> 
> > .
> > .
> > .
> >
> > -
> > access.log:
> > =
> > 127.0.0.1 - - [15/Feb/2009:15:05:41 -0800] "GET /blog/v_blog/ HTTP/
> > 1.1" 200 565
> > 127.0.0.1 - - [15/Feb/2009:15:05:43 -0800] "GET /media/img/
> > people_rose.jpg HTTP/1.1" 404 2001
> > 127.0.0.1 - - [15/Feb/2009:15:05:44 -0800] "GET /favicon.ico HTTP/1.1"
> > 404 1944
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: mod_wsgi+apache2.2+django1+WindowsXP: can't serve images

2009-02-15 Thread Graham Dumpleton



On Feb 16, 10:19 am, MrBodjangles  wrote:
> I am going thru the sample blog application introduced in the book
> "Python Web Development with Django (covers Django 1.0)".
>
> Before getting too deep into the book, I decided I wanted to first
> ensure that the application will render in apache since I want to
> include an image at the bottom of the blog posts (I have been hacking
> spaghetti code in php for a couple of years now, but now, am intent on
> coding neatly with python).
>
> The blog application works partially in that apache renders the text
> contents, but not the image.
>
> Note the access.log contents in the end ( "GET /media/img/
> people_rose.jpg HTTP/1.1" 404 2001)
>
> I have read so much good stuff about Django that I want to dive into
> it full speed ahead, but now I am stuck in serving a simple image.
>
> Help?
>
> --
> httpd.conf:
> ===
> .
> .
> .
> 
> # I will put this later in a separe conf file
> ###
> # This did not work ==>>>  AliasMatch ^/([^/]+)/media/(.*) "c:/my_wsgi/
> media"
> #
> # trying AliasMatch below...still does not work :>(
> #
>
> AliasMatch ^media/(.*) "c:/my_wsgi/media/"

Use Alias directive, not AliasMatch, as described in mod_wsgi
documentation. See:

  http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango

Perform direct URL accesses against stuff in media directory to
ascertain if working or not.

> 
> Order allow,deny
> Options Indexes
> Allow from all
> IndexOptions FancyIndexing
> 
>
> WSGIScriptAliasMatch ^/([^/]+) "c:/my_wsgi/apache/django.wsgi"

Again, read the documentation. Do not use WSGIScriptAliasMatch, use
WSGIScriptAlias.

Why are you using the Match variants? Where did you get the idea you
had to do that?

Try what is in the documentation instead.

Graham

> 
> Order deny,allow
> Allow from all
> 
> 
>
> #
> # DirectoryIndex: sets the file that Apache will serve if a directory
> # is requested.
> .
> .
> .
>
> 
> django.wsgi:
> 
> import os, sys
>
> #Calculate the path based on the location of the WSGI script.
> apache_configuration= os.path.dirname(__file__)
> project = os.path.dirname(apache_configuration)
> workspace = os.path.dirname(project)
>
> sys.path.append(workspace)
> sys.path.append('c:\\my_wsgi')
>
> os.environ['DJANGO_SETTINGS_MODULE'] = 'blog.settings'
> import django.core.handlers.wsgi
> application = django.core.handlers.wsgi.WSGIHandler()
>
> 
> settings.py:
> 
> .
> .
> .
> # Absolute path to the directory that holds media.
> # Example: "/home/media/media.lawrence.com/"
> MEDIA_ROOT = ''
>
> # URL that handles the media served from MEDIA_ROOT. Make sure to use
> a
> # trailing slash if there is a path component (optional in other
> cases).
> # Examples: "http://media.lawrence.com";, "http://example.com/media/";
> MEDIA_URL = ''
>
> # URL prefix for admin media -- CSS, JavaScript and images. Make sure
> to use a
> # trailing slash.
> # Examples: "http://foo.com/media/";, "/media/".
> ADMIN_MEDIA_PREFIX = '/media/'
> .
> .
> .
>
> 
> base.html (lives in c:\my_wsgi\blog\templates):
> ==
> .
> .
> .
> 
> {%block content %}
> {%endblock%}
>
>  
>  height="848"> 
> .
> .
> .
>
> -
> access.log:
> =
> 127.0.0.1 - - [15/Feb/2009:15:05:41 -0800] "GET /blog/v_blog/ HTTP/
> 1.1" 200 565
> 127.0.0.1 - - [15/Feb/2009:15:05:43 -0800] "GET /media/img/
> people_rose.jpg HTTP/1.1" 404 2001
> 127.0.0.1 - - [15/Feb/2009:15:05:44 -0800] "GET /favicon.ico HTTP/1.1"
> 404 1944
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



mod_wsgi+apache2.2+django1+WindowsXP: can't serve images

2009-02-15 Thread MrBodjangles

I am going thru the sample blog application introduced in the book
"Python Web Development with Django (covers Django 1.0)".

Before getting too deep into the book, I decided I wanted to first
ensure that the application will render in apache since I want to
include an image at the bottom of the blog posts (I have been hacking
spaghetti code in php for a couple of years now, but now, am intent on
coding neatly with python).

The blog application works partially in that apache renders the text
contents, but not the image.

Note the access.log contents in the end ( "GET /media/img/
people_rose.jpg HTTP/1.1" 404 2001)

I have read so much good stuff about Django that I want to dive into
it full speed ahead, but now I am stuck in serving a simple image.

Help?

--
httpd.conf:
===
.
.
.

# I will put this later in a separe conf file
###
# This did not work ==>>>  AliasMatch ^/([^/]+)/media/(.*) "c:/my_wsgi/
media"
#
# trying AliasMatch below...still does not work :>(
#

AliasMatch ^media/(.*) "c:/my_wsgi/media/"

Order allow,deny
Options Indexes
Allow from all
IndexOptions FancyIndexing


WSGIScriptAliasMatch ^/([^/]+) "c:/my_wsgi/apache/django.wsgi"

Order deny,allow
Allow from all



#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
.
.
.


django.wsgi:

import os, sys

#Calculate the path based on the location of the WSGI script.
apache_configuration= os.path.dirname(__file__)
project = os.path.dirname(apache_configuration)
workspace = os.path.dirname(project)

sys.path.append(workspace)
sys.path.append('c:\\my_wsgi')

os.environ['DJANGO_SETTINGS_MODULE'] = 'blog.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()


settings.py:

.
.
.
# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = ''

# URL that handles the media served from MEDIA_ROOT. Make sure to use
a
# trailing slash if there is a path component (optional in other
cases).
# Examples: "http://media.lawrence.com";, "http://example.com/media/";
MEDIA_URL = ''

# URL prefix for admin media -- CSS, JavaScript and images. Make sure
to use a
# trailing slash.
# Examples: "http://foo.com/media/";, "/media/".
ADMIN_MEDIA_PREFIX = '/media/'
.
.
.



base.html (lives in c:\my_wsgi\blog\templates):
==
.
.
.

{%block content %}
{%endblock%}

 
 
.
.
.


-
access.log:
=
127.0.0.1 - - [15/Feb/2009:15:05:41 -0800] "GET /blog/v_blog/ HTTP/
1.1" 200 565
127.0.0.1 - - [15/Feb/2009:15:05:43 -0800] "GET /media/img/
people_rose.jpg HTTP/1.1" 404 2001
127.0.0.1 - - [15/Feb/2009:15:05:44 -0800] "GET /favicon.ico HTTP/1.1"
404 1944




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---