diff options
author | Roberto De Ioris <roberto@unbit.it> | 2012-12-28 14:32:27 +0100 |
---|---|---|
committer | Roberto De Ioris <roberto@unbit.it> | 2012-12-28 14:32:27 +0100 |
commit | 09fe2960b5496996706aab6852b68185644f2e8c (patch) | |
tree | 84175d0269fff529a58d9abb52b007bf0ffaeb35 /examples | |
parent | cf5794e22c21b45b764359762752141ef038b90d (diff) | |
download | uwsgi-09fe2960b5496996706aab6852b68185644f2e8c.tar.gz |
another cleanup
Diffstat (limited to 'examples')
-rw-r--r-- | examples/bootstrap.py | 5 | ||||
-rw-r--r-- | examples/bootstrap2.py | 4 | ||||
-rw-r--r-- | examples/bootstrap3.py | 5 | ||||
-rw-r--r-- | examples/bootstrap4.py | 4 | ||||
-rw-r--r-- | examples/bootstrap5.py | 3 | ||||
-rw-r--r-- | examples/router.lua | 33 |
6 files changed, 54 insertions, 0 deletions
diff --git a/examples/bootstrap.py b/examples/bootstrap.py new file mode 100644 index 00000000..aa77c4c2 --- /dev/null +++ b/examples/bootstrap.py @@ -0,0 +1,5 @@ +import sys +import uwsgi + +print("i am the bootstrap for uwsgi.SymbolsImporter") +sys.meta_path.insert(0, uwsgi.SymbolsImporter()) diff --git a/examples/bootstrap2.py b/examples/bootstrap2.py new file mode 100644 index 00000000..a07b8b39 --- /dev/null +++ b/examples/bootstrap2.py @@ -0,0 +1,4 @@ +import sys +import uwsgi + +sys.meta_path.insert(0, uwsgi.SymbolsZipImporter("pygments_zip")) diff --git a/examples/bootstrap3.py b/examples/bootstrap3.py new file mode 100644 index 00000000..405a5ac3 --- /dev/null +++ b/examples/bootstrap3.py @@ -0,0 +1,5 @@ +import sys +import uwsgi + +sys.meta_path.insert(0, uwsgi.SymbolsZipImporter("django_zip:djenv/lib/python2.6/site-packages")) +sys.meta_path.insert(0, uwsgi.SymbolsZipImporter("djapp_zip")) diff --git a/examples/bootstrap4.py b/examples/bootstrap4.py new file mode 100644 index 00000000..43f30b32 --- /dev/null +++ b/examples/bootstrap4.py @@ -0,0 +1,4 @@ +import sys +import uwsgi + +sys.meta_path.insert(0, uwsgi.ZipImporter("data://0")) diff --git a/examples/bootstrap5.py b/examples/bootstrap5.py new file mode 100644 index 00000000..340e6889 --- /dev/null +++ b/examples/bootstrap5.py @@ -0,0 +1,3 @@ +import uwsgi + +print uwsgi.extract("data://0") diff --git a/examples/router.lua b/examples/router.lua new file mode 100644 index 00000000..9730e0b5 --- /dev/null +++ b/examples/router.lua @@ -0,0 +1,33 @@ +print("uWSGI Lua router") + +uwsgi.log("i am ready") + +function route(env) + + print(env.REQUEST_URI) + + html = uwsgi.cache_get(env.REQUEST_URI) + + local function send_cache() + coroutine.yield(html) + end + + local function body() + page = "" + parts = { uwsgi.send_message("127.0.0.1:3033", 0, 0, env, 30, uwsgi.req_fd(), uwsgi.cl()) } + for i, part in pairs(parts) do + page = page .. part + coroutine.yield(part) + end + + uwsgi.cache_set(env.REQUEST_URI, page) + end + + if html then + return nil,{}, coroutine.wrap(send_cache) + end + + return nil,{}, coroutine.wrap(body) +end + +return route |