Search code examples
pythonwindowstestcase

how to install moztrap on windows 8.1?


I want to install moztrap locally on my pc. As a reference, I use https://moztrap.readthedocs.org/en/1.4.6/installation.html.

Environment:

  • OS windows 8.1 x64 professional
  • XAMPP
  • Visual Studio 2013 x64 express
  • Python 3.4.1
  • Installation directory: c:\xampp\htdocs\moztrap

1- git clone --recursive git://github.com/mozilla/moztrap

2- cd moztrap

3- mkvirtualenv moztrap

These three steps are OK. But I cannot get the 4 step onward working.

4- bin/install-reqs

I get the following:

C:\xampp\htdocs\moztrap>bin/install-reqs

'bin' is not recognized as an internal or external command,
operable program or batch file.

install=-reqs can be found https://raw.githubusercontent.com/mozilla/moztrap/master/bin/install-reqs'>here.

So can anyone help me with this? (I need to mention I do not know python, or else this might be so easy!)


Solution

  • After trying multiple solutions, I got the followings steps to work (note that we are using this https://moztrap.readthedocs.org/en/1.4.6/installation.html'>doc as reference):

    1- git clone --recursive git://github.com/mozilla/moztrap
    

    You may you need to change the protocol from git to http if you are behind a firewall that does not allow git protocol. Also you need to git the submodules also with http in this case.

    2- cd moztrap
    
    3- mkvirtualenv moztrap
    

    These steps are OK.

    For step 4 there are some issues using the given default command 4- bin/install-reqs. There are few requirements mentioned in \requirements\compiled.txt that are C libraries and need compilation. I faced following issues:

    • It needs a Visual Studio 2008 for compilation
    • Even after installation of VS 2008, there are problems compling the packages all together.

    So I chose to first install the compiled packages one by one, and then install without complied dependenciesinstall-reqs pure. So before that:

    • Get the .exe file for MySQL-python from https://pypi.python.org/pypi/MySQL-python/1.2.4'>here
    • Use pip install py-bcrypt-w32 (also needs VS 2008 for compilation), installing pip install py-bcrypt did NOT work.

      4- python bin\install-reqs pure

    Then:

    Create moztrap\settings\local.py and enter the database credentials (you can make a copy of local.sample.py then uncomment the database part). Then:

    5- echo "CREATE DATABASE moztrap CHARACTER SET utf8" | c:\xampp\bin\mysql
    
    6- python manage.py syncdb --migrate
    
    7- python manage.py create_default_roles
    
    8- python manage.py runserver
    

    And now you can visit http://localhost:8000 in your browser and that is it! You are done!


    Please remember that you need:

    • Visual Studio 2008, the later versions cause problems during insatallation
    • Use Python 2.7, Python 3 causes problems during insatallation