[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

HOWTO: Serve htags generated website (CGI, AJAX and all) using just Pyth

From: Alain Kalker
Subject: HOWTO: Serve htags generated website (CGI, AJAX and all) using just Python. No scripting required.
Date: Fri, 08 Feb 2013 00:55:13 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130109 Thunderbird/17.0.2

Perhaps not all of you know this, but it is possible (and very convenient :-) to serve the website generated by for example:

$ htags --suggest2

using nothing more than a Python installation. No need to edit daunting configuration files, change (or ask for) permissions, etcetera.

Here's how:

First, setup GTAGSROOT
In the root of your source directory, where the tags files and HTML directory are, do: $ pwd > GTAGSROOT # This is needed so that global.cgi can find the tags files

Next, start Python's built-in HTTP/CGI server.

If you're using Python 3.x, do:
$ (cd HTML; python -m http.server --cgi)

If you're using Python 2.x, do:
$ (cd HTML; python -m CGIHTTPServer)

Now, you can surf to: http://localhost:8000/index.html
and browse and search your source code, with all the AJAX goodness like symbol completion, dynamic cross-references, etc.

Well, almost.

Currently, there is a small problem, when a search for a symbol returns only 1 result, you will get a blank page instead of being taken to the source file with the symbol. I have sent a patch to address this problem to the bug-global mailing list (look for "[PATCH][Feature request] global.cgi: Add a fallback redirect method for webservers which do not support CGI redirects". I hope this issue gets fixed soon.

Have fun :-)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]