doc/book/admin/setup-windows.rst
changeset 10491 c67bcee93248
parent 9916 986797d779ea
child 12530 9d88e1177c35
equal deleted inserted replaced
10490:76ab3c71aff2 10491:c67bcee93248
       
     1 .. -*- coding: utf-8 -*-
       
     2 
       
     3 .. _SetUpWindowsEnv:
       
     4 
       
     5 Installing a development environement on Windows
       
     6 ================================================
       
     7 
       
     8 Setting up a Windows development environment is not too complicated
       
     9 but it requires a series of small steps.
       
    10 
       
    11 We propose an example of a typical |cubicweb| installation on Windows
       
    12 from sources. We assume everything goes into ``C:\\`` and for any
       
    13 package, without version specification, "the latest is
       
    14 the greatest".
       
    15 
       
    16 Mind that adjusting the installation drive should be straightforward.
       
    17 
       
    18 
       
    19 
       
    20 Install the required elements
       
    21 -----------------------------
       
    22 
       
    23 |cubicweb| requires some base elements that must be installed to run
       
    24 correctly. So, first of all, you must install them :
       
    25 
       
    26 * python >= 2.6 and < 3
       
    27   (`Download Python <http://www.python.org/download/>`_).
       
    28   You can also consider the Python(x,y) distribution
       
    29   (`Download Python(x,y) <http://code.google.com/p/pythonxy/wiki/Downloads>`_)
       
    30   as it makes things easier for Windows user by wrapping in a single installer
       
    31   python 2.7 plus numerous useful third-party modules and
       
    32   applications (including Eclipse + pydev, which is an arguably good
       
    33   IDE for Python under Windows).
       
    34 
       
    35 * `Twisted <http://twistedmatrix.com/trac/>`_ is an event-driven
       
    36   networking engine
       
    37   (`Download Twisted <http://twistedmatrix.com/trac/>`_)
       
    38 
       
    39 * `lxml <http://codespeak.net/lxml/>`_ library
       
    40   (version >=2.2.1) allows working with XML and HTML
       
    41   (`Download lxml <http://pypi.python.org/pypi/lxml/2.2.1>`_)
       
    42 
       
    43 * `Postgresql <http://www.postgresql.org/>`_,
       
    44   an object-relational database system
       
    45   (`Download Postgresql <http://www.enterprisedb.com/products/pgdownload.do#windows>`_)
       
    46   and its python drivers
       
    47   (`Download psycopg <http://www.stickpeople.com/projects/python/win-psycopg/#Version2>`_)
       
    48 
       
    49 * A recent version of `gettext`
       
    50   (`Download gettext <http://download.logilab.org/pub/gettext/gettext-0.17-win32-setup.exe>`_).
       
    51 
       
    52 * `rql <http://www.logilab.org/project/rql>`_,
       
    53   the recent version of the Relationship Query Language parser.
       
    54 
       
    55 Install optional elements
       
    56 -------------------------
       
    57 
       
    58 We recommend you to install the following elements. They are not
       
    59 mandatory but they activate very interesting features in |cubicweb|:
       
    60 
       
    61 * `python-ldap <http://pypi.python.org/pypi/python-ldap>`_
       
    62   provides access to LDAP/Active directory directories
       
    63   (`Download python-ldap <http://www.osuch.org/python-ldap>`_).
       
    64 
       
    65 * `graphviz <http://www.graphviz.org/>`_
       
    66   which allow schema drawings.
       
    67   (`Download graphviz <http://www.graphviz.org/Download_windows.php>`_).
       
    68   It is quite recommended (albeit not mandatory).
       
    69 
       
    70 Other elements will activate more features once installed. Take a look
       
    71 at :ref:`InstallDependencies`.
       
    72 
       
    73 Useful tools
       
    74 ------------
       
    75 
       
    76 Some additional tools could be useful to develop :ref:`cubes <AvailableCubes>`
       
    77 with the framework.
       
    78 
       
    79 * `mercurial <http://mercurial.selenic.com/>`_ and its standard windows GUI
       
    80   (`TortoiseHG <http://tortoisehg.bitbucket.org/>`_) allow you to get the source
       
    81   code of |cubicweb| from control version repositories. So you will be able to
       
    82   get the latest development version and pre-release bugfixes in an easy way
       
    83   (`Download mercurial <http://bitbucket.org/tortoisehg/stable/wiki/download>`_).
       
    84 
       
    85 * You can also consider the ssh client `Putty` in order to peruse
       
    86   mercurial over ssh (`Download <http://www.putty.org/>`_).
       
    87 
       
    88 * If you are an Eclipse user, mercurial can be integrated using the
       
    89   `MercurialEclipse` plugin
       
    90   (`Home page <http://www.vectrace.com/mercurialeclipse/>`_).
       
    91 
       
    92 Getting the sources
       
    93 -------------------
       
    94 
       
    95 There are two ways to get the sources of |cubicweb| and its
       
    96 :ref:`cubes <AvailableCubes>`:
       
    97 
       
    98 * download the latest release (:ref:`SourceInstallation`)
       
    99 * get the development version using Mercurial
       
   100   (:ref:`MercurialInstallation`)
       
   101 
       
   102 Environment variables
       
   103 ---------------------
       
   104 
       
   105 You will need some convenience environment variables once all is set up. These
       
   106 variables are settable through the GUI by getting at the `System properties`
       
   107 window (by righ-clicking on `My Computer` -> `properties`).
       
   108 
       
   109 In the `advanced` tab, there is an `Environment variables` button. Click on
       
   110 it. That opens a small window allowing edition of user-related and system-wide
       
   111 variables.
       
   112 
       
   113 We will consider only user variables. First, the ``PATH`` variable. Assuming
       
   114 you are logged as user *Jane*, add the following paths, separated by
       
   115 semi-colons::
       
   116 
       
   117   C:\Documents and Settings\Jane\My Documents\Python\cubicweb\cubicweb\bin
       
   118   C:\Program Files\Graphviz2.24\bin
       
   119 
       
   120 The ``PYTHONPATH`` variable should also contain::
       
   121 
       
   122   C:\Documents and Settings\Jane\My Documents\Python\cubicweb\
       
   123 
       
   124 From now, on a fresh `cmd` shell, you should be able to type::
       
   125 
       
   126   cubicweb-ctl list
       
   127 
       
   128 ... and get a meaningful output.
       
   129 
       
   130 Running an instance as a service
       
   131 --------------------------------
       
   132 
       
   133 This currently assumes that the instances configurations is located at
       
   134 ``C:\\etc\\cubicweb.d``. For a cube 'my_instance', you will find
       
   135 ``C:\\etc\\cubicweb.d\\my_instance\\win32svc.py``.
       
   136 
       
   137 Now, register your instance as a windows service with::
       
   138 
       
   139   win32svc install
       
   140 
       
   141 Then start the service with::
       
   142 
       
   143   net start cubicweb-my_instance
       
   144 
       
   145 In case this does not work, you should be able to see error reports in
       
   146 the application log, using the windows event log viewer.