Mercurial and hgweb for IIS 7.5 - python error

I am trying to get Mercurial to host on IIS 7.5 (Win 7 x64) and continue to work with an error that I did not seem to fix.

I followed the tutorial by Jeremy Skiners: Mercurial on IIS7

Instead of hgwebdir, I use hgweb as I use Mercurial 1.7.2

I have python installed and running. I installed the IIS application for Mercurial in http: // localhost / hg โ†’ in the directory c: \ inetpub \ wwwroot \ hg

I put the template directory in c: \ inetpub \ wwwroot \ hg I extracted the library.zip file in c: \ inetpub \ wwwroot \ hg

When I visited the site, I get an error โ†’ File "C: \ inetpub \ wwwroot \ hg \ hgweb.cgi", line 15, from the mercurial importimport request; requestimport.enable () ImportError: no module named mercurial ".

While searching for this error, I found the following answers: stack overflow

Following the accepted answer, I changed my hgweb.cgi like this:

#!c:/python/python26/python.exe # # An example hgweb CGI script, edit as necessary # See also https://www.mercurial-scm.org/wiki/PublishingRepositories # Path to repo or hgweb config to serve (see 'hg help hgweb') config = "/path/to/repo/or/config" # Uncomment and adjust if Mercurial is not installed system-wide: import sys; sys.path.insert(0, "c:\inetpub\wwwroot\hg") # Uncomment to send python tracebacks to the browser if an error occurs: #import cgitb; cgitb.enable() from mercurial import demandimport; demandimport.enable() from mercurial.hgweb import hgweb, wsgicgi application = hgweb('c:\inetpub\wwwroot\hg\hgweb.config') wsgicgi.launch(application) 

After that, I still get the same error. I have no idea what else to do. Any help would be greatly appreciated.

Edi 1: Screenshot of c: \ inetpub \ wwwroot \ hg as requested: My hg directory

+9
python mercurial iis hgweb
Dec 04 '10 at 19:01
source share
4 answers

I struggled with the same setup last week or so.

It seems to me that they have made some significant changes to how Mercurial has been working in IIS recently, so the link above to Jeremy Skiners' tutorial will be problematic for 1.7.2

This is a later link. I found that I had to do a couple of things differently.

These instructions are for 1.7.x, if you are using 1.8.x, be sure to read the Ethan comment below!

I followed the instructions in the comment / contrib / win 32 / hgwebdir_wsgi.py .

  • Install Python 2.6.6

  • Add Python to your PATH system (to make life easier)

  • Install pywin32 v214 (using the Python Installer, it is important!) (Note that this is built against python 2.6)

  • Install isapi_wsgi

  • download a package from a mercury source
    Extract, then run

     python setup.py --pure build_py -c -d.  build_ext -i build_mo --force
     python setup.py --pure install --force
    
  • Copy hgwebdir_wsgi.py from / contrib / win 32 to the folder in which you want to place it.

  • Create the hgweb.config file in the folder from which you are going to host. Add Content

     [paths]
     yourRepoName = c: \ yourRepoLocation
    
  • Modify hgwebdir_wsgi.py to specify hgweb.config. path_prefix is โ€‹โ€‹0 if hg is the root of the website. if you put it in the depth of vdir 1, then it is 1, etc.

  • Run python hgwebdir_wsgi.py to create isapi dll _hgwebdir_wsgi.dll. The console should print "installation complete"

  • Build your application pool in IIS (no managed code)

  • Create your site using the install folder in the same folder as hgwebdir_wsgi.py

  • Add a handler of type Module, use "*" as the display, select _hgwebdir_wsgi.dll as the executable file, select isapimodule as the type, Mercurial-ISAPI as the name (although the name really does not matter)

  • Change permissions to allow execution.

web.config (for the previous two steps):

 <system.webServer> <handlers accessPolicy="Read, Execute, Script"> <add name="Mercurial-Isapi" path="*" verb="*" modules="IsapiModule" scriptProcessor="C:\inetpub\hgweb\_hgwebdir_wsgi.dll" resourceType="Unspecified" /> </handlers> </system.webServer> 

After all this, I was able to get it to work.

The last thing I copied MFC71.dll to windows / system32, although I'm not sure if this was necessary http://python.net/crew/skippy/win32/

I think the main difference between what I have and the one from the link above is that I did a "pure python" mercurial install, although I am a complete newbie to python, so I'm not sure. In addition, I installed "python installs" for pywin and isapi_wsgi, rather than plain msis. Windows

+15
Dec 6 2018-10-06
source share

Adam Boddington wrote an updated installation description, which works now: http://stackingcode.com/blog/2011/02/24/running-a-mercurial-server-on-iis-7-5-windows-server-2008-r2

+3
Mar 25 2018-11-11T00:
source share

I wrote the latest instructions on how to set up a mercury repository on IIS7 using the current versions of Mercurial (1.8.x) like the current version of Python (2.7).

This will work for you, and I appreciate if you use it to vote on an answer (or down;)).

+3
Jun 28 '11 at 5:14
source share

I used to have a lot of mistakes. Uninstalled all python, pywin32, isapi_wsgi and installed it as above. He worked like a breeze. Luke

+1
Dec 30 '10 at 15:19
source share



All Articles