author | Matt Mackall <mpm@selenic.com> |
Sun, 10 Dec 2006 20:08:16 -0600 | |
changeset 3867 | d210a1b05cf6 |
parent 3781 | 713e35dcc321 |
child 3868 | 6033d9f28052 |
permissions | -rw-r--r-- |
202 | 1 |
#!/usr/bin/env python |
159 | 2 |
# |
3 |
# An example CGI script to use hgweb, edit as necessary |
|
4 |
||
5 |
import cgitb, os, sys |
|
391
5f65a108a559
hgweb: pull cgitb into CGI script example, where it can easily be disabled
mpm@selenic.com
parents:
202
diff
changeset
|
6 |
cgitb.enable() |
5f65a108a559
hgweb: pull cgitb into CGI script example, where it can easily be disabled
mpm@selenic.com
parents:
202
diff
changeset
|
7 |
|
159 | 8 |
# sys.path.insert(0, "/path/to/python/lib") # if not a system-wide install |
2506
d0db3462d568
This patch make several WSGI related alterations.
Eric Hopper <hopper@omnifarious.org>
parents:
391
diff
changeset
|
9 |
from mercurial.hgweb.hgweb_mod import hgweb |
d0db3462d568
This patch make several WSGI related alterations.
Eric Hopper <hopper@omnifarious.org>
parents:
391
diff
changeset
|
10 |
from mercurial.hgweb.request import wsgiapplication |
d0db3462d568
This patch make several WSGI related alterations.
Eric Hopper <hopper@omnifarious.org>
parents:
391
diff
changeset
|
11 |
import mercurial.hgweb.wsgicgi as wsgicgi |
159 | 12 |
|
3781
713e35dcc321
hgweb: report detected character set
Matt Mackall <mpm@selenic.com>
parents:
2506
diff
changeset
|
13 |
# If you'd like to serve pages with UTF-8 instead of your default |
713e35dcc321
hgweb: report detected character set
Matt Mackall <mpm@selenic.com>
parents:
2506
diff
changeset
|
14 |
# locale charset, you can do so by uncommenting the following lines. |
713e35dcc321
hgweb: report detected character set
Matt Mackall <mpm@selenic.com>
parents:
2506
diff
changeset
|
15 |
# Note that this will cause your .hgrc files to be interpreted in |
713e35dcc321
hgweb: report detected character set
Matt Mackall <mpm@selenic.com>
parents:
2506
diff
changeset
|
16 |
# UTF-8 and all your repo files to be displayed using UTF-8. |
713e35dcc321
hgweb: report detected character set
Matt Mackall <mpm@selenic.com>
parents:
2506
diff
changeset
|
17 |
# |
713e35dcc321
hgweb: report detected character set
Matt Mackall <mpm@selenic.com>
parents:
2506
diff
changeset
|
18 |
# os.environ["HGENCODING"] = "UTF-8" |
713e35dcc321
hgweb: report detected character set
Matt Mackall <mpm@selenic.com>
parents:
2506
diff
changeset
|
19 |
|
2506
d0db3462d568
This patch make several WSGI related alterations.
Eric Hopper <hopper@omnifarious.org>
parents:
391
diff
changeset
|
20 |
def make_web_app(): |
d0db3462d568
This patch make several WSGI related alterations.
Eric Hopper <hopper@omnifarious.org>
parents:
391
diff
changeset
|
21 |
return hgweb("/path/to/repo", "repository name") |
d0db3462d568
This patch make several WSGI related alterations.
Eric Hopper <hopper@omnifarious.org>
parents:
391
diff
changeset
|
22 |
|
d0db3462d568
This patch make several WSGI related alterations.
Eric Hopper <hopper@omnifarious.org>
parents:
391
diff
changeset
|
23 |
wsgicgi.launch(wsgiapplication(make_web_app)) |