Convert isolated Python code into a web application

I have a bunch of useful codes written in Python that would be useful for academicians / researchers / students / simple end users who don’t need to know the code. However, to use these codes I thought asking everyone to install Python and requisite libraries would be bothersome and somewhat wasteful (imagine a user who wants to visualize a shortest path algorithm is asked to install all these). A simple and well known solution is to convert these Python codes into web-based applications, so that the codes live on my server and computations happen on the server. The users provide the inputs over a web interface and get the outputs on the same interface.

Even though the task seems simple, I struggled initially to get it done. In spite of having big frameworks, e.g., Django / Flask etc., I found the simple CGI scripting much easier to understand and useful for this kind of applications, even though it requires a bit of coding. A Python CGI script is a Python script that generates a webpage dynamically and uses the standard tags of the HTML for I/O. An introductory tutorial is here. The advantage is that you can convert your Python code into an web-application quite quickly. Of course, you need to worry about giving the CGI scripts executable permission and have to set your (Apache) server to render those scripts to be executable on the web. But there are tutorials available on how to do that. What I finally struggled with is to get a web-hosting site where I can put my scripts to run. Turns out that there were many such sites (an example list is here), and I simply missed them for not searching with appropriate keywords.

Now, things are all set. You have written a basic Python code – converted it into a Python CGI script – found a host that lets you execute the CGI scripts – populated the appropriate directory with the scripts and voilà, your scripts are online. I’m sharing my experience as many would like to do the same.

As an example of how I did it, I have written a Python script that runs the Gale-Shapley deferred acceptance algorithm (you can google it for more details) to match students to advisors. It can as well be used for matching students to schools / departments having a fixed capacity. A sample output is here. The whole project is on GitHub. The Facebook page for this app. “Like” it if you like it. There are still some updates required for this app since I haven’t included error handling much. But basically it does what I wanted.


IISc PhD / Master’s Thesis Format

I have struggled a lot with the thesis format and never really found a format that works smoothly. Either tikz doesn’t work or wrapfig, and throws up a large amount of errors. If you want to make your thesis look nice and beautiful, I’m afraid you need to use packages like tikz, color, graphicx, hyperref, breakurl etc. So, the native IISc thesis was incompatible with all of them. In particular, it creates a pretty bland form of the thesis which is a pain to read online. Remember for online viewing (which happens most often in the web these days), you need to have a nice navigation, and that means you should have hyperlinking within the document. It is always useful if I can click from the contents page and land up to the place what I wanted to read. So, I thought of hacking a bit on the template and here is the bundle for LaTeX which you can use to create such a file.

LaTeX files .zip archive of the IISc Thesis

It is quite self-explanatory. Just write your chapters separately and save as corresponding .tex files and include in the thesis.tex file and compile the thesis.tex. For an aid, I have put a script file in the archive, so that you can just run ./script on the terminal and it will generate the thesis.pdf. If the script is not executable, change the mode. Open a terminal, and type the following.

chmod 777 script

If everything goes okay, you should be on the top of your thesis, congratulations! You should be able to generate this document. Just go to the contents page and click on the page numbers, and then you’ll appreciate all that I was talking about. Good luck!

Update: Just got a feedback that sharing the synopsis template would also be useful. So, here is the LaTeX template and the corresponding PDF.

Like this page if you find it useful, also let me know if there are any troubles with the file.

A bit of self advertisement: I made my thesis using this template.

A Short Course on Mechanism Design by Prof. Arunava Sen


Prof. Arunava Sen

Arunava Sen, Professor in the Economics and Planning Unit at the Indian Statistical Institute, New Delhi, India, is going to deliver a short course on “Selected Topics in Mechanism Design” in CSA, IISc during the week April 1 – 5, 2013. Prof. Sen received his Ph.D. from Princeton University (1987) and M.Phil. from Oxford University (1982) and joined ISI Delhi in 1987. He is a globally-recognized economic theorist and has published several papers in leading international journals including Econometrica, Journal of Economic Theory, Social Choice and Welfare, Games and Economic Behavior, Review of Economic Studies, Journal of Mathematical Economics, and the Journal of Mathematical Psychology. He is the recipient of the Infosys prize on social sciences for the year 2012. He is also a great motivator for young scientists, here is an example.


Lecture schedule:

Note: The topics are a little broad at this moment. Depending on the interest of the audience, it might be fine-tuned.

Prerequisites: Basic knowledge of mechanism design theory and familiarity with mathematical analysis.

Venue: CSA 254

Title: Selected Topics in Mechanism Design

Consolidated lecture notes

Lecture 1: The Implementation Problem – Maskin’s Theorem.

Date and time: April 1, 6 – 7.30 PM

Lecture video

Lecture 2: Proof of Maskin’s Theorem.

Date and time: April 3, 6 – 7.30 PM

Lecture video

Lecture 3: Subgame-Perfect Implementation and Implementation with Behavioral Agents.

Date and time: April 5, 6 – 7.30 PM

Lecture video

We will update this page for any new announcements. So, please keep an eye on this. If you haven’t signed up yet, please do it here. We also need scribes for the lectures. Please let us know during the class that you are interested in scribing the lectures. We will split the task so that nobody needs to work too much.

Installing Debian

After using Ubuntu for quite sometime, got a little bored with the new bugs. In particular the new bug that freezes the display in Precise. So I thought about trying out Debian. Yes, the great grandfather of all these species, the Debian. The problem is none of the CD-ROM drives work properly in our lab, so I decided to use the USB boot. It used to work like a charm using unetbootin, however, it gave a lot of trouble for Debian. I found the following 3 pages very useful to prepare the bootable disk: page 1, page 2, page 3. Thanks community support, Debian is good!

To get Debian, one must use the jigdo files if the local repository is available.

Shanti Swarup Bhatnagar Award 2012

In the area of Science and Technology, S.S. Bhatnagar award is considered to be the highest honor among the scientists in India. The announcement for this year’s award has been made. It is good to see three of the faculty members of our institute getting this prize: Govindsamy Mugesh in Chemical Sciences, Ravishankar Narayanan in Engineering Sciences, and Arindam Ghosh in Physical Sciences. Congratulations to all of them. One interesting observation is that this year, almost all awardees are young faculties. It is a very commendable move and worth welcoming. Hope is that, some new moves by the government will even be welcomed by the opposition.

Journal of US-China Public Administration Call for Papers (Spam)

I recently got an email from an email id . It appears a spam, however, just bringing into your notice so that you can share your thoughts and similar experiences, if any.

From Knowledge to Wisdom

Journal of US-China Public Administration


International Standard Serial Number: ISSN 1548-6591 (print)   ISSN 1935-9691 (online)

Dear S******* N*** ,

This is Journal of US-China Public Administration. We are glad to know you have submitted a paper named<The Correct Title of the Paper> in the 11th Meeting of <correct name of the conference>. We are very interested in your research, if you have unpublished article on hand and have the idea of making our journal a vehicle for your research interests, please send electronic version of your paper to us.

As an American academic publishing group, we hope to keep in touch by email and can publish some papers or books for you and your friends in USA, wishing to become your friends if necessary. We also want to invite some people to be our reviewers or become our editorial board members. If you are interested in our journal, you can send your CV to us. Expect to get your reply soon.

About the Journal

Journal of US-China Public Administration, a professional journal sponsored by American Sino-US Association of Entrepreneurs, and published across the United States by David Publishing Company, USA, and this journal is regularly published by China National Publication Import & Export Corporation on commission.

Journal of US-China Public Administration is collected and indexed by the Library of U.S Congress, on whose official website ( an on-line inquiry can be triggered with its publication number ISSN1548-6591 as key words in “Basic Search” column. In addition, this journal is also retrieved by some renowned databases:

Database of EBSCO, Massachusetts, USA
Hein Online Database, W.S.HEIN, USA
Chinese Database of CEPS, American Federal Computer Library center (OCLC), USA
Chinese Scientific Journals Database, VIP Corporation, Chongqing, P.R.China
Ulrich’s Periodicals Direcory
ProQuest/CSA Social Science Collection, Public Affairs Information Service (PAIS), USA
Summon Serials Solutions

Current columns involve interdisciplinary topics including analysis of developments in the organizational, administrative and policy sciences, public management, land resource management, social security, educational economy and management, social medicine and health service management, national political and economical affairs, social work, management theory and practice etc.

David Publishing is strived to provide the best platform for researchers and scholars worldwide to exchange their latest findings and results. We admire your achievements, and we understand how important your research impact to other peers in the same interest field and other disciplines, and how delighted you would be when communicating with global professional peers. Your contribution to our journals would be very much welcome!

Information for Authors

1. The manuscript should be original, and has not been published previously. Do not submit material that is currently being considered by another journal.
2. Manuscripts may be 3000-8000 words or longer if approved by the editor, including an abstract, texts, tables, footnotes, appendixes, and references. The title should not be exceeding 15 words, and abstract should not be exceeding 300 words. 3-5 keywords or key phrases are required.
3. The manuscript should be in MS Word format, submitted as an email attachment to our email address.
4. Authors of the articles being accepted, we will keep copyright.
5. Author will receive 2 copies of the issue of the journal containing their article.

Peer Review Policy

Journal of US-China Public Administration is peer review journal. All research articles in this journal undergo rigorous peer review, based on initial editor screening and anonymous refereeing by at least two anonymous referees.

Editorial Procedures

All papers considered appropriate for this journal are reviewed anonymously by at least two outside reviewers. The review process usually takes two to three weeks. Papers are accepted for publication subject to no substantive, stylistic editing. The Editor reserves the right to make any necessary changes in the papers, or request the author to do so, or reject the paper submitted. A copy of the edited paper along with the first proofs will be sent to the author for proofreading. They should be corrected and returned to the Editor within seven days. Once the final version of the paper has been accepted, authors are requested not to make further changes to the text.

Submission of Manuscript

All manuscripts submitted will be considered for publication. Please visit our website at   or send papers to  or

Should you have any questions or concerns feel free to contact us.

Best regards,
Editor Office
Journal of US-China Public Administration
David Publishing Company