doc/book/admin/setup-windows.rst
branch3.27
changeset 12857 24a15a69b84a
parent 12856 a82e56d4814a
child 12858 f021b9b887a9
equal deleted inserted replaced
12856:a82e56d4814a 12857:24a15a69b84a
     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 * `lxml <http://codespeak.net/lxml/>`_ library
       
    36   (version >=2.2.1) allows working with XML and HTML
       
    37   (`Download lxml <http://pypi.python.org/pypi/lxml/2.2.1>`_)
       
    38 
       
    39 * `Postgresql <http://www.postgresql.org/>`_,
       
    40   an object-relational database system
       
    41   (`Download Postgresql <http://www.enterprisedb.com/products/pgdownload.do#windows>`_)
       
    42   and its python drivers
       
    43   (`Download psycopg <http://www.stickpeople.com/projects/python/win-psycopg/#Version2>`_)
       
    44 
       
    45 * A recent version of `gettext`
       
    46   (`Download gettext <http://download.logilab.org/pub/gettext/gettext-0.17-win32-setup.exe>`_).
       
    47 
       
    48 * `rql <http://www.logilab.org/project/rql>`_,
       
    49   the recent version of the Relationship Query Language parser.
       
    50 
       
    51 Install optional elements
       
    52 -------------------------
       
    53 
       
    54 We recommend you to install the following elements. They are not
       
    55 mandatory but they activate very interesting features in |cubicweb|:
       
    56 
       
    57 * `python-ldap <http://pypi.python.org/pypi/python-ldap>`_
       
    58   provides access to LDAP/Active directory directories
       
    59   (`Download python-ldap <http://www.osuch.org/python-ldap>`_).
       
    60 
       
    61 * `graphviz <http://www.graphviz.org/>`_
       
    62   which allow schema drawings.
       
    63   (`Download graphviz <http://www.graphviz.org/Download_windows.php>`_).
       
    64   It is quite recommended (albeit not mandatory).
       
    65 
       
    66 Other elements will activate more features once installed. Take a look
       
    67 at :ref:`InstallDependencies`.
       
    68 
       
    69 Useful tools
       
    70 ------------
       
    71 
       
    72 Some additional tools could be useful to develop :ref:`cubes <AvailableCubes>`
       
    73 with the framework.
       
    74 
       
    75 * `mercurial <http://mercurial.selenic.com/>`_ and its standard windows GUI
       
    76   (`TortoiseHG <http://tortoisehg.bitbucket.org/>`_) allow you to get the source
       
    77   code of |cubicweb| from control version repositories. So you will be able to
       
    78   get the latest development version and pre-release bugfixes in an easy way
       
    79   (`Download mercurial <http://bitbucket.org/tortoisehg/stable/wiki/download>`_).
       
    80 
       
    81 * You can also consider the ssh client `Putty` in order to peruse
       
    82   mercurial over ssh (`Download <http://www.putty.org/>`_).
       
    83 
       
    84 * If you are an Eclipse user, mercurial can be integrated using the
       
    85   `MercurialEclipse` plugin
       
    86   (`Home page <http://www.vectrace.com/mercurialeclipse/>`_).
       
    87 
       
    88 Getting the sources
       
    89 -------------------
       
    90 
       
    91 There are two ways to get the sources of |cubicweb| and its
       
    92 :ref:`cubes <AvailableCubes>`:
       
    93 
       
    94 * download the latest release (:ref:`SourceInstallation`)
       
    95 * get the development version using Mercurial
       
    96   (:ref:`MercurialInstallation`)
       
    97 
       
    98 Environment variables
       
    99 ---------------------
       
   100 
       
   101 You will need some convenience environment variables once all is set up. These
       
   102 variables are settable through the GUI by getting at the `System properties`
       
   103 window (by righ-clicking on `My Computer` -> `properties`).
       
   104 
       
   105 In the `advanced` tab, there is an `Environment variables` button. Click on
       
   106 it. That opens a small window allowing edition of user-related and system-wide
       
   107 variables.
       
   108 
       
   109 We will consider only user variables. First, the ``PATH`` variable. Assuming
       
   110 you are logged as user *Jane*, add the following paths, separated by
       
   111 semi-colons::
       
   112 
       
   113   C:\Documents and Settings\Jane\My Documents\Python\cubicweb\cubicweb\bin
       
   114   C:\Program Files\Graphviz2.24\bin
       
   115 
       
   116 The ``PYTHONPATH`` variable should also contain::
       
   117 
       
   118   C:\Documents and Settings\Jane\My Documents\Python\cubicweb\
       
   119 
       
   120 From now, on a fresh `cmd` shell, you should be able to type::
       
   121 
       
   122   cubicweb-ctl list
       
   123 
       
   124 ... and get a meaningful output.
       
   125 
       
   126 Running an instance as a service
       
   127 --------------------------------
       
   128 
       
   129 This currently assumes that the instances configurations is located at
       
   130 ``C:\\etc\\cubicweb.d``. For a cube 'my_instance', you will find
       
   131 ``C:\\etc\\cubicweb.d\\my_instance\\win32svc.py``.
       
   132 
       
   133 Now, register your instance as a windows service with::
       
   134 
       
   135   win32svc install
       
   136 
       
   137 Then start the service with::
       
   138 
       
   139   net start cubicweb-my_instance
       
   140 
       
   141 In case this does not work, you should be able to see error reports in
       
   142 the application log, using the windows event log viewer.