public
Description: TiddlyWeb Core
Homepage: http://tiddlyweb.peermore.com/
Clone URL: git://github.com/tiddlyweb/tiddlyweb.git
tiddlyweb / index.cgi
100755 70 lines (52 sloc) 2.254 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/python
 
"""
This is a CGI script that can be used for running
TiddlyWeb under a web server, instead of using the
sever that is built in.
 
Put the cgi somewhere your web server can run cgis. You
can rename it if you like. Make sure the file is executable.
 
If you are using the text store (you probably are) follow
the instructions in COOKBOOK to make a text store directory
structure somewhere. The directory hierarchy must be writable
by the web server. In tiddlywebconfig.py you need to set server_store
and store_root to point to that directory:
 
'server_store': ['text', {'store_root': '/some/path/to/store'}],
'server_prefix': '/~cdent/tw/index.cgi',
'server_host': {
'scheme': 'http',
'host': 'burningchrome.com',
'port': '80'},
 
You need to choose a location where your tiddlywebconfig.py will
live. This is also where you should put any plugins you are using
and where tiddlyweb.log will be written. You may need to create
tiddlyweb.log yourself, and set its permissions so the server can
write to it.
 
Whatever location you choose for your tiddlywebconfig.py set to
tiddlywebconfig_dir to that directory, in the script below.
 
You will need to set server_prefix and server_host in the
tiddlywebconfig.py in the location that you choose.
 
'server_prefix': '/~cdent/tw/index.cgi',
'server_host': {
'scheme': 'http',
'host': 'burningchrome.com',
'port': '80'},
 
It is a good idea for your store directory and tiddlywebconfig_dir
to be different places.
 
You may need to change the PYTHON_EGG_CACHE setting.
 
See http://tiddlyweb.peemore.com for general documentation and
http://bengillies.net/.a/#%5B%5BRunning%20on%20TiddlyWeb%2C%20Part%20One%5D%5D
for an installation tutorial, specifically for people who
do not have root access on their server.
"""
 
import os
import sys
 
tiddlywebconfig_dir = '/home/cdent/hot_html/tw'
 
os.environ['PYTHON_EGG_CACHE'] = '/tmp'
os.chdir(tiddlywebconfig_dir)
 
from wsgiref.handlers import BaseCGIHandler
from tiddlyweb.web import serve
 
def start():
    app = serve.load_app()
    BaseCGIHandler(sys.stdin, sys.stdout, sys.stderr, os.environ).run(app)
 
if __name__ == '__main__':
    start()