the current release is 0.4.
mod_proxy_http
, or something like lighttpd or nginx - img2 runs as a long running process with an embedded http server. you setup your webserver to proxy requests (except for static content or uploaded files) to img2.
/branches/0.4
) from svn.
static/
and uploaded_files/
from the checkout dir to the web document-root for your chosen domain.
localhost:63331
(or whatever you choose, this is the default...)
mod_proxy_http
, and create a .htaccess
in web root containing:
RewriteEngine On RewriteRule ^(robots\.txt|favicon\.ico)$ /static/$1 [QSA,L] RewriteCond %{REQUEST_URI} !^/(static|uploaded_files) RewriteRule ^(.*)$ http://localhost:63331/$1 [QSA,P,L]
mod_proxy
, and add something like this to your config:
$HTTP["host"] == "img2.website.com" { server.document-root = <your-doc-root> $HTTP["url"] =~ "^/(?!static|uploaded_files|favicon\.ico|robots\.txt)" { proxy.server = ("/" => (( "host" => "127.0.0.1", "port" => 63331, )) ) } url.rewrite-once = ( "^/favicon\.ico$" => "/static/favicon.ico", "^/robots\.txt$" => "/static/robots.txt", ) server.max-request-size = 4096 $HTTP["url"] =~ "^/(uploaded_files|static)/" { expire.url = ( "" => "access 1 months" ) } }
chmod +x bootstrap.py
and then ./bootstrap.py
cache/
from under your webroot, as you did for static/
and uploaded_files/
.magnet_cache.lua
:
if lighty.env["uri.query"] or string.find(lighty.request["Cookie"] or "", "mod=1") then return nil end function url_quote (s) return s.gsub(s, "[^a-zA-Z0-9_.-]", function (c) return string.format("%%%02X", string.byte(c)) end) end name = url_quote(lighty.env["uri.path"]) file = lighty.env["physical.doc-root"] .. "/cache/" .. name gzip_file = lighty.env["physical.doc-root"] .. "/cache/gzip/" .. name if lighty.stat(gzip_file) and string.find(lighty.request["Accept-Encoding"] or "", "gzip") then lighty.header["Content-Type"] = "text/html; charset=utf-8" lighty.header["Content-Encoding"] = "gzip" lighty.content = {{filename = gzip_file}} return 200 elseif lighty.stat(file) then lighty.header["Content-Type"] = "text/html; charset=utf-8" lighty.content = {{filename = file}} return 200 end
magnet.attract-physical-path-to = (<path/to/magnet_cache.lua>)
directly above the proxy.server = ...
line.
cache/
- cached pages.
databases/
- database files.
img2/
- python code.
static/
- non-dynamic resources needed for web pages, eg. css.
templates/
- templates, look in img2/util/templates.py for info on the template format.
uploaded_files/
- files for posts.
bootstrap.py
- the script you run to start img2.
readme.html
- this file
CACHING = False
in img2/common.py
./bootstrap -x
to create a default admin account.