summaryrefslogtreecommitdiff
path: root/py2/cherrypy/scaffold
diff options
context:
space:
mode:
authorRobert Brewer <fumanchu@aminus.org>2011-02-25 22:38:17 +0000
committerRobert Brewer <fumanchu@aminus.org>2011-02-25 22:38:17 +0000
commitfd8b1e2a2662d965f05a14c2c72701decd81697c (patch)
treef6b7f89ffb181bc940c7d9b3541f01f25b49699d /py2/cherrypy/scaffold
parent5450bb603f7e0cf91d216225d3fa3f524710bcd6 (diff)
downloadcherrypy-git-trunk.tar.gz
Bringing python3 back into trunk with its own py3 folder; what was in trunk goes in the py2 folder, and we can use a single setup.py to install either, depending on the version of Python that runs setup.py install.trunk
Diffstat (limited to 'py2/cherrypy/scaffold')
-rw-r--r--py2/cherrypy/scaffold/__init__.py61
-rw-r--r--py2/cherrypy/scaffold/apache-fcgi.conf22
-rw-r--r--py2/cherrypy/scaffold/example.conf3
-rw-r--r--py2/cherrypy/scaffold/site.conf14
-rw-r--r--py2/cherrypy/scaffold/static/made_with_cherrypy_small.pngbin0 -> 7455 bytes
5 files changed, 100 insertions, 0 deletions
diff --git a/py2/cherrypy/scaffold/__init__.py b/py2/cherrypy/scaffold/__init__.py
new file mode 100644
index 00000000..00964ac5
--- /dev/null
+++ b/py2/cherrypy/scaffold/__init__.py
@@ -0,0 +1,61 @@
+"""<MyProject>, a CherryPy application.
+
+Use this as a base for creating new CherryPy applications. When you want
+to make a new app, copy and paste this folder to some other location
+(maybe site-packages) and rename it to the name of your project,
+then tweak as desired.
+
+Even before any tweaking, this should serve a few demonstration pages.
+Change to this directory and run:
+
+ ../cherryd -c site.conf
+
+"""
+
+import cherrypy
+from cherrypy import tools, url
+
+import os
+local_dir = os.path.join(os.getcwd(), os.path.dirname(__file__))
+
+
+class Root:
+
+ _cp_config = {'tools.log_tracebacks.on': True,
+ }
+
+ def index(self):
+ return """<html>
+<body>Try some <a href='%s?a=7'>other</a> path,
+or a <a href='%s?n=14'>default</a> path.<br />
+Or, just look at the pretty picture:<br />
+<img src='%s' />
+</body></html>""" % (url("other"), url("else"),
+ url("files/made_with_cherrypy_small.png"))
+ index.exposed = True
+
+ def default(self, *args, **kwargs):
+ return "args: %s kwargs: %s" % (args, kwargs)
+ default.exposed = True
+
+ def other(self, a=2, b='bananas', c=None):
+ cherrypy.response.headers['Content-Type'] = 'text/plain'
+ if c is None:
+ return "Have %d %s." % (int(a), b)
+ else:
+ return "Have %d %s, %s." % (int(a), b, c)
+ other.exposed = True
+
+ files = cherrypy.tools.staticdir.handler(
+ section="/files",
+ dir=os.path.join(local_dir, "static"),
+ # Ignore .php files, etc.
+ match=r'\.(css|gif|html?|ico|jpe?g|js|png|swf|xml)$',
+ )
+
+
+root = Root()
+
+# Uncomment the following to use your own favicon instead of CP's default.
+#favicon_path = os.path.join(local_dir, "favicon.ico")
+#root.favicon_ico = tools.staticfile.handler(filename=favicon_path)
diff --git a/py2/cherrypy/scaffold/apache-fcgi.conf b/py2/cherrypy/scaffold/apache-fcgi.conf
new file mode 100644
index 00000000..922398ea
--- /dev/null
+++ b/py2/cherrypy/scaffold/apache-fcgi.conf
@@ -0,0 +1,22 @@
+# Apache2 server conf file for using CherryPy with mod_fcgid.
+
+# This doesn't have to be "C:/", but it has to be a directory somewhere, and
+# MUST match the directory used in the FastCgiExternalServer directive, below.
+DocumentRoot "C:/"
+
+ServerName 127.0.0.1
+Listen 80
+LoadModule fastcgi_module modules/mod_fastcgi.dll
+LoadModule rewrite_module modules/mod_rewrite.so
+
+Options ExecCGI
+SetHandler fastcgi-script
+RewriteEngine On
+# Send requests for any URI to our fastcgi handler.
+RewriteRule ^(.*)$ /fastcgi.pyc [L]
+
+# The FastCgiExternalServer directive defines filename as an external FastCGI application.
+# If filename does not begin with a slash (/) then it is assumed to be relative to the ServerRoot.
+# The filename does not have to exist in the local filesystem. URIs that Apache resolves to this
+# filename will be handled by this external FastCGI application.
+FastCgiExternalServer "C:/fastcgi.pyc" -host 127.0.0.1:8088 \ No newline at end of file
diff --git a/py2/cherrypy/scaffold/example.conf b/py2/cherrypy/scaffold/example.conf
new file mode 100644
index 00000000..93a6e53c
--- /dev/null
+++ b/py2/cherrypy/scaffold/example.conf
@@ -0,0 +1,3 @@
+[/]
+log.error_file: "error.log"
+log.access_file: "access.log" \ No newline at end of file
diff --git a/py2/cherrypy/scaffold/site.conf b/py2/cherrypy/scaffold/site.conf
new file mode 100644
index 00000000..6ed38983
--- /dev/null
+++ b/py2/cherrypy/scaffold/site.conf
@@ -0,0 +1,14 @@
+[global]
+# Uncomment this when you're done developing
+#environment: "production"
+
+server.socket_host: "0.0.0.0"
+server.socket_port: 8088
+
+# Uncomment the following lines to run on HTTPS at the same time
+#server.2.socket_host: "0.0.0.0"
+#server.2.socket_port: 8433
+#server.2.ssl_certificate: '../test/test.pem'
+#server.2.ssl_private_key: '../test/test.pem'
+
+tree.myapp: cherrypy.Application(scaffold.root, "/", "example.conf")
diff --git a/py2/cherrypy/scaffold/static/made_with_cherrypy_small.png b/py2/cherrypy/scaffold/static/made_with_cherrypy_small.png
new file mode 100644
index 00000000..c3aafeed
--- /dev/null
+++ b/py2/cherrypy/scaffold/static/made_with_cherrypy_small.png
Binary files differ