~widelands-dev/widelands-website/solitaire_html_documentation

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
Installing the homepage
=======================

Getting the homepage to run locally is best supported using virtualenv and
pip. Install those two tools first, either via easy_install or via your local
package manager. You will also need development tools (gcc or therelike), hg
(mercurial), bzr, subversion and git. Finally you are going to need the
build dependencies for numpy, which will be compiled as a part of getting
the dependencies for the website. Go and install them all.

Example:
On Ubuntu, installing all required tools and dependencies in two commands:

   $ sudo apt-get install python-dev python-virtualenv python-pip mercurial bzr subversion git-core sqlite3
   $ sudo apt-get build-dep python-numpy

Used python version
-------------------

Currently, the website depends on python 2.7. In case you have python 3 as default (like on arch-linux),
you have to adjust the python relevant commands to use python 2.7. E.g. 'virtualenv2 wlwebsite' creates
a virtualenvironment using python 2.7. If the virtualenvironment is activated, python 2.7 will become
standard for executing python code in this shell.

Setting up the local environment
--------------------------------

Go to the directory you want to install the homepage to, then run:

   $ export PYTHONPATH=

This will make sure that your virtual environment is not tainted with python
packages from your global site packages. Very important!
Now, we create and activate our environment:

   $ virtualenv wlwebsite
   $ cd wlwebsite
   $ source bin/activate

Next, we download the website source code::

   $ mkdir code
   $ cd code
   $ bzr branch lp:widelands-website widelands
   $ cd widelands

All fine and good. Now we have to install all the third party modules the
website needs. We use pip for that.

Installation of the third party libraries should be easy, given you have
development tools installed and in your path. The two difficult packages are
PIL and numpy; you can also try to migrate them over from your global site dir
or add your global site dir to your PYTHONPATH.
Installation via pip should work like this::

   $ pip install -r pip_requirements.txt

This will take a while. If no errors are shown we should be fine.

Setting up the website
======================

Setting your local paths
------------------------

Copy or symlink the two files settings_local.py.sample and
local_urls.py.sample to settings_local.py and local_urls.py. Take a look at
those files and modify them to your needs - most likely everything works
directly, but you might want to edit the bd variable in local_settings.py::

   $ ln -s local_urls.py.sample local_urls.py
   $ ln -s local_settings.py.sample local_settings.py

Setting up the database
-----------------------

Now creating the tables in the database:

   $ ./manage.py migrate

Create a superuser:

   $ ./manage.py createsuperuser

Now, let's run the page::

   $ ./manage.py runserver

Open your browser to http://localhost:8000. You should see something that
resembles the widelands homepage quite closely. All content is missing though.

Some important settings
-----------------------

Go to http://localhost:8000/admin. Log in with your super user and go to the
following table:

- Site/Sites: Change your site name from example.com to localhost:8000.

Now everything should work.

Accessing the website from other machines
-----------------------------------------

When starting the server as described above, the website will by default
only be available from the machine it is running on. If you wish to access
the website from other machines you need to specify an IP-address and
port number. Please note, however, that this server is NOT intended for
production environments, only for development/testing.

   $ ./manage.py runserver 169.254.1.0:8000

See also https://docs.djangoproject.com/en/dev/ref/django-admin/#examples-of-using-different-ports-and-addresses
for further details.

Dependencies between website and widelands source code
======================================================

Some parts of the website need access to the source code of widelands:

* Online help/Encyclopedia
* Possibility to upload a map onto the local website
* Source code documentation

You will need the widelands source code for this, see

https://wl.widelands.org/wiki/BzrPrimer/

After the source code is downloaded, adjust the path of 

WIDELANDS_SVN_DIR

in local_settings.py to the path where the widelands source code is found.

Setting up the online help / encyclopedia
-----------------------------------------

You will need graphviz to generate the graphs for the online help. On Ubuntu run:

   $ sudo apt-get install graphviz

To generate the online help database switch to your local environment and run:

   $ ./manage.py update_help

After that you can create the overview pdf files with

   $ ./manage.py update_help_pdf

Setting up widelands source code documentation
----------------------------------------------

There is a small helper script to get the documenation. Be sure
you have set WIDELANDS_SVN_DIR set in local_settings.py. Run:

   $ _ops/create_docs.py

After finishing without errors, type localhost:8000/documentation/index.html
in your browsers addressbar or click on "Development -> Documentation".
Note: The links in the produced documentation work only if you have
called '_ops/create_docs' with DEBUG=True in your settings.

Uploading a map to the local website
------------------------------------

Compile the widelands binaries by using the compile.sh script

   $ ./compile.sh

Now you should be able to upload a map onto your local website.

Contact
=======

Contact SirVer on the homepage for more information and problems.


-- vim:ft=rst: