Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge remote branch 'upstream/master'

  • Loading branch information...
commit 51e75836364fc16c2e16b7e437ba3a094d2e3c0c 2 parents 822269a + 1674219
@marios-zindilis marios-zindilis authored
View
6 cookbook/fastcgi-apache.md
@@ -7,7 +7,7 @@ title: Web.py using FastCGI and Apache 2
#Requirements
* Apache 2.x
-* [mod_fcgid](http://fastcgi.coremail.cn/)
+* [mod_fcgid](http://httpd.apache.org/mod_fcgid/)
* [mod_rewrite](http://httpd.apache.org/docs/2.0/rewrite/)
* [Flup](http://trac.saddi.com/flup)
@@ -104,4 +104,6 @@ Did you add this line?
web.wsgi.runwsgi = lambda func, addr=None: web.wsgi.runfcgi(func, addr)
</pre>
#Misc
-After updating your application you may need to restart your web server to see the changes.
+* After updating your application you may need to restart your web server to see the changes.
+* If you do not have root access to your Apache server, you may not have access to all of the above commands in the .htaccess file in your project directory. [See this githup repository](http://github.com/stevekochscience/webpy-bluehost-helloworld) for a first-draft workaround, using hosted server on bluehost.com. (This is a hack written by someone who doesn't understand Apache and web.py thoroughly.)
+
View
2  docs/0.3/tutorial.md
@@ -225,7 +225,7 @@ Now add another class:
def POST(self):
i = web.input()
n = db.insert('todo', title=i.title)
- raise web.seeother('/')
+ raise web.seeother('/')
(Notice how we're using `POST` for this?)
View
10 images.md
@@ -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
@@ -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()
View
8 install.md
@@ -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()
@@ -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:
View
11 quick_vhosting_hack.md
@@ -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.
@@ -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):
@@ -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
View
12 template_tricks.md
@@ -10,9 +10,11 @@ title: template tricks
Test the rendering of a template.py template
def renderTemplate(templatename,*args,**kw):
- '''quick way to test a template.py template''' import template
+ '''quick way to test a template.py template'''
+ import template
if not "." in templatename:
- templatename = templatename + ".tmpl" obj = template.Template(open(templatename).read())
+ templatename = templatename + ".tmpl"
+ obj = template.Template(open(templatename).read())
return obj(*args,**kw)
print renderTemplate("homepage", now=time.ctime())
@@ -20,7 +22,9 @@ Test the rendering of a template.py template
If your template takes a dict or a storage, then you can just
set global values and let those get passed in:
- username = "User" lastvisit = "yesterday" print renderTemplate("results", store=web.Storage(globals()))
+ username = "User"
+ lastvisit = "yesterday"
+ print renderTemplate("results", store=web.Storage(globals()))
---
@@ -54,4 +58,4 @@ you forget the space, you'll get this error from template.py:
myElement = $$('elementID');
----
+---
Please sign in to comment.
Something went wrong with that request. Please try again.