Skip to content

Commit

Permalink
Merge pull request #31 from stevekochscience/master
Browse files Browse the repository at this point in the history
fixed typos/formatting in three pages
  • Loading branch information
aaronsw committed Aug 1, 2012
2 parents 7e1bcec + ab74372 commit 9713861
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
10 changes: 5 additions & 5 deletions images.md
Expand Up @@ -7,7 +7,7 @@ title: Serving Images

## Basic Directory Set-up

First let your urls extend beyound images:
First let your urls extend beyond images:

import web

Expand All @@ -25,12 +25,12 @@ Now create the class that will handle them:
cType = {
"png":"images/png",
"jpg":"image/jpeg",
"gif":"image/gif",
"ico":"image/x-icon" }
"jpg":"images/jpeg",
"gif":"images/gif",
"ico":"images/x-icon" }

if name in os.listdir('images'): # Security
web.header("Content-Type", cType[ext]) # Set the Header
return open('images/%s'%name,"rb").read() # Notice 'rb' for reading images
else:
raise web.notfound()
raise web.notfound()
8 changes: 5 additions & 3 deletions install.md
Expand Up @@ -157,8 +157,9 @@ Note: The way `web.py` is implemented breaks the `cgitb` module because it captu
# ... import web etc here...

def cgidebugerror():
"""
""" _wrappedstdout = sys.stdout
"""
"""
_wrappedstdout = sys.stdout

sys.stdout = web._oldstdout
cgitb.handler()
Expand All @@ -175,7 +176,8 @@ FastCGI is easy to configure and performs as well as mod_python.

Add this to your `.htaccess`:

<Files code.py> SetHandler fastcgi-script
<Files code.py>
SetHandler fastcgi-script
</Files>

Unfortunately, unlike lighttpd, Apache gives no hint that it wants your web.py script to act as a FastCGI server so you have to tell web.py explicitly. Add this to `code.py` before your `if __name__ == "__main__":` line:
Expand Down
11 changes: 6 additions & 5 deletions quick_vhosting_hack.md
Expand Up @@ -9,11 +9,11 @@ Here is a 10 minute hack with lots of room for improvement but I think its
pretty useful. I made this to allow the serving of multiple
sites from a single webpy app.

I created this because I would like to run a few small sites but my cheep
I created this because I would like to run a few small sites but my cheap
account at my hosting provider:

* Only allows 40MB to be used by persistant processes.
* Only allows *one* persistant process.
* Only allows 40MB to be used by persistent processes.
* Only allows *one* persistent process.
* Multiple instances of webpy would require multiple ports to be proxied with apache's mod_proxy
and this configuration can only be done by the server admin.

Expand Down Expand Up @@ -56,7 +56,7 @@ The /static directory is currently still shared between all sites.

#
## VHOSTING DECORATOR
#
#
def vhostrr(vhosts=vhosts):
def decorator(func):
def proxyfunc(*args, **kw):
Expand All @@ -70,7 +70,8 @@ The /static directory is currently still shared between all sites.
print 'Error, Not configured for vhost: '+rd
return
else:
print 'Direct access not allowed. Use proxy.' return
print 'Direct access not allowed. Use proxy.'
return
return func(mapping=mapping, *args, **kw)
return proxyfunc
return decorator
Expand Down

0 comments on commit 9713861

Please sign in to comment.