Wiki

Version 183 (Etienne Pallier, 03/22/2016 10:11 am)

1 1 Etienne Pallier
h1. Technical Documentation for the PYROS project (FGFT-CC)
2 1 Etienne Pallier
3 1 Etienne Pallier
4 1 Etienne Pallier
HOWTO Format Redmine Wiki : http://www.redmine.org/projects/redmine/wiki/FrRedmineWikiFormatting
5 1 Etienne Pallier
6 1 Etienne Pallier
{{>toc}}
7 1 Etienne Pallier
8 1 Etienne Pallier
9 121 Etienne Pallier
---
10 1 Etienne Pallier
11 121 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}I - TODO%
12 121 Etienne Pallier
13 126 Etienne Pallier
 * installation sur windows
14 125 Etienne Pallier
15 126 Etienne Pallier
 * gitlab
16 1 Etienne Pallier
17 126 Etienne Pallier
 * séparation des BD Django et Pyros
18 125 Etienne Pallier
19 126 Etienne Pallier
 * intégration dans Eclipse
20 126 Etienne Pallier
21 174 Etienne Pallier
 * Intégration des modules Django déjà développés
22 125 Etienne Pallier
23 121 Etienne Pallier
24 3 Etienne Pallier
---
25 1 Etienne Pallier
26 140 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}I - DATABASE SCHEMA (v0.2.1)%
27 116 Etienne Pallier
28 116 Etienne Pallier
29 117 Etienne Pallier
{{thumbnail(PYROS_PDM_v021.png, size=300, title=Pyros data model)}}
30 121 Etienne Pallier
31 121 Etienne Pallier
32 121 Etienne Pallier
---
33 116 Etienne Pallier
34 141 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}II - Get the project (from gitlab)%
35 141 Etienne Pallier
36 141 Etienne Pallier
https://gitlab.irap.omp.eu/epallier/pyros
37 141 Etienne Pallier
38 161 Etienne Pallier
https://gitlab.irap.omp.eu/epallier/pyros.git
39 161 Etienne Pallier
40 161 Etienne Pallier
ssh git@gitlab.irap.omp.eu:epallier/pyros.git
41 141 Etienne Pallier
42 1 Etienne Pallier
43 169 Etienne Pallier
44 169 Etienne Pallier
h3. Get the project from the terminal
45 169 Etienne Pallier
46 174 Etienne Pallier
<pre>
47 1 Etienne Pallier
git clone https://gitlab.irap.omp.eu/epallier/pyros.git PYROS
48 1 Etienne Pallier
49 174 Etienne Pallier
(or also : git clone git@gitlab.irap.omp.eu:epallier/pyros.git)
50 174 Etienne Pallier
</pre>
51 174 Etienne Pallier
52 174 Etienne Pallier
If you just want a static copy of the project (without synchronization) just remove the .git/ folder :
53 174 Etienne Pallier
<pre>
54 174 Etienne Pallier
$ rm -r .git/
55 174 Etienne Pallier
</pre>
56 169 Etienne Pallier
57 169 Etienne Pallier
h3. Get the project from Eclipse
58 169 Etienne Pallier
59 169 Etienne Pallier
TODO:
60 169 Etienne Pallier
61 141 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}III - INSTALLATION%
62 2 Etienne Pallier
63 120 Etienne Pallier
64 120 Etienne Pallier
---
65 120 Etienne Pallier
66 51 Etienne Pallier
h3. If necessary, install MySql
67 2 Etienne Pallier
68 49 Etienne Pallier
 * Linux Ubuntu
69 49 Etienne Pallier
<pre>
70 107 Paul Carensac
71 107 Paul Carensac
$ sudo apt-get install mysql-server
72 107 Paul Carensac
$ sudo apt-get install mysql-client
73 107 Paul Carensac
74 49 Etienne Pallier
</pre>
75 49 Etienne Pallier
76 49 Etienne Pallier
 * Linux CentOS
77 49 Etienne Pallier
<pre>
78 49 Etienne Pallier
TODO:
79 49 Etienne Pallier
$ sudo yum install mysql
80 49 Etienne Pallier
...
81 49 Etienne Pallier
</pre>
82 49 Etienne Pallier
83 49 Etienne Pallier
 * Mac OS X
84 1 Etienne Pallier
Install XAMPP
85 1 Etienne Pallier
(but you could also use the pre-installed Mac OS MySql)
86 177 Etienne Pallier
<pre>
87 177 Etienne Pallier
TODO:
88 49 Etienne Pallier
</pre>
89 1 Etienne Pallier
90 49 Etienne Pallier
 * Windows
91 177 Etienne Pallier
Install XAMPP
92 49 Etienne Pallier
<pre>
93 49 Etienne Pallier
TODO:
94 49 Etienne Pallier
</pre>
95 49 Etienne Pallier
96 49 Etienne Pallier
97 49 Etienne Pallier
---
98 1 Etienne Pallier
99 183 Etienne Pallier
h3. Install python3.5 (if necessary)
100 1 Etienne Pallier
101 11 Etienne Pallier
102 11 Etienne Pallier
 * Mac OS X :
103 1 Etienne Pallier
<pre>
104 183 Etienne Pallier
105 24 Etienne Pallier
1) Installer MacPort
106 24 Etienne Pallier
(TODO: doc)
107 24 Etienne Pallier
108 24 Etienne Pallier
2) Installer le "port" python35
109 1 Etienne Pallier
$ sudo port install python35
110 183 Etienne Pallier
111 1 Etienne Pallier
</pre>
112 1 Etienne Pallier
113 1 Etienne Pallier
 * Linux (Ubuntu) :
114 1 Etienne Pallier
<pre>
115 107 Paul Carensac
sudo add-apt-repository ppa:fkrull/deadsnakes
116 107 Paul Carensac
sudo apt-get update
117 107 Paul Carensac
sudo apt-get install python3.5
118 107 Paul Carensac
119 107 Paul Carensac
sudo pip install virtualenv
120 23 Etienne Pallier
</pre>
121 1 Etienne Pallier
122 1 Etienne Pallier
123 183 Etienne Pallier
 * Windows 10 :
124 183 Etienne Pallier
<pre>
125 183 Etienne Pallier
(TODO:
126 183 Etienne Pallier
</pre>
127 3 Etienne Pallier
128 4 Etienne Pallier
---
129 5 Etienne Pallier
130 59 Etienne Pallier
h3. Get the project (from git)
131 59 Etienne Pallier
132 78 Etienne Pallier
<pre>
133 59 Etienne Pallier
TODO:
134 79 Etienne Pallier
135 130 Etienne Pallier
$ git http://pyros... PYROS
136 78 Etienne Pallier
</pre>
137 1 Etienne Pallier
138 130 Etienne Pallier
This creates a PYROS folder containing the project
139 59 Etienne Pallier
140 59 Etienne Pallier
141 59 Etienne Pallier
---
142 59 Etienne Pallier
143 131 Etienne Pallier
h3. Create project structure
144 131 Etienne Pallier
145 131 Etienne Pallier
<pre>
146 131 Etienne Pallier
$ mkdir PYROS
147 132 Etienne Pallier
</pre>
148 131 Etienne Pallier
149 131 Etienne Pallier
Example of a good organization :
150 131 Etienne Pallier
151 131 Etienne Pallier
1 project = N applis
152 158 Etienne Pallier
1 appli = N models
153 158 Etienne Pallier
A! L’appli est à côté du projet, PAS DEDANS,
154 158 Etienne Pallier
cela facilite la REUTILISATION
155 158 Etienne Pallier
(an appli can be part of many projects => reuse)
156 131 Etienne Pallier
1 appli = 1 Python module, organized for Django, by default = appli web (but not mandatory)
157 131 Etienne Pallier
158 131 Etienne Pallier
<pre>
159 131 Etienne Pallier
160 131 Etienne Pallier
MYPROJECT/
161 171 Etienne Pallier
	REQUIREMENTS.txt
162 131 Etienne Pallier
	src/
163 131 Etienne Pallier
		myproject/
164 131 Etienne Pallier
		appli1/
165 131 Etienne Pallier
		appli2/
166 131 Etienne Pallier
167 131 Etienne Pallier
		appliN/
168 131 Etienne Pallier
169 131 Etienne Pallier
	public/
170 131 Etienne Pallier
		static/
171 131 Etienne Pallier
172 131 Etienne Pallier
	private/
173 148 Etienne Pallier
		venv_py35_pyros/
174 131 Etienne Pallier
175 131 Etienne Pallier
</pre>
176 131 Etienne Pallier
177 131 Etienne Pallier
178 131 Etienne Pallier
Set needed folders:
179 131 Etienne Pallier
<pre>
180 131 Etienne Pallier
$ cd PYROS/
181 131 Etienne Pallier
$ mkdir private public
182 131 Etienne Pallier
$ mkdir public/static
183 131 Etienne Pallier
</pre>
184 131 Etienne Pallier
185 131 Etienne Pallier
186 131 Etienne Pallier
187 131 Etienne Pallier
---
188 131 Etienne Pallier
189 3 Etienne Pallier
h3. Create virtualenv with python3.5 dedicated to pyros project (inside the project folder)
190 127 Etienne Pallier
191 131 Etienne Pallier
<pre>
192 1 Etienne Pallier
193 133 Etienne Pallier
$ cd private/
194 3 Etienne Pallier
195 3 Etienne Pallier
$ which python3.5
196 3 Etienne Pallier
/opt/local/bin/python3.5
197 15 Etienne Pallier
198 127 Etienne Pallier
$ virtualenv-3.5 venv_py35_pyros -p /opt/local/bin/python3.5
199 3 Etienne Pallier
=> creates a venv_py35_pyros/ folder inside PYROS/private/
200 1 Etienne Pallier
201 131 Etienne Pallier
</pre>
202 1 Etienne Pallier
203 7 Etienne Pallier
---
204 3 Etienne Pallier
205 65 Etienne Pallier
h3. Activate the python virtual environment (from inside the project)
206 7 Etienne Pallier
207 55 Etienne Pallier
<pre>
208 1 Etienne Pallier
209 65 Etienne Pallier
$ pwd
210 134 Etienne Pallier
.../PYROS/private
211 1 Etienne Pallier
212 65 Etienne Pallier
$ source ./venv_py35_pyros/bin/activate
213 65 Etienne Pallier
214 3 Etienne Pallier
$ python -V
215 1 Etienne Pallier
Python 3.5.1
216 3 Etienne Pallier
217 3 Etienne Pallier
$ which pip
218 77 Etienne Pallier
.../PYROS/venv_py35_pyros/bin/pip
219 16 Etienne Pallier
220 18 Etienne Pallier
Upgrade pip to last version available :
221 3 Etienne Pallier
$ pip install --upgrade pip
222 3 Etienne Pallier
Collecting pip
223 3 Etienne Pallier
  Downloading pip-8.1.1-py2.py3-none-any.whl (1.2MB)
224 3 Etienne Pallier
Installing collected packages: pip
225 3 Etienne Pallier
  Found existing installation: pip 7.1.2
226 3 Etienne Pallier
    Uninstalling pip-7.1.2:
227 3 Etienne Pallier
      Successfully uninstalled pip-7.1.2
228 1 Etienne Pallier
Successfully installed pip-8.1.1
229 55 Etienne Pallier
230 55 Etienne Pallier
</pre>
231 18 Etienne Pallier
232 27 Etienne Pallier
h3. Install needed python packages (from within the virtual environment)
233 18 Etienne Pallier
234 66 Etienne Pallier
First, be sure that the virtual environment is activated:
235 66 Etienne Pallier
<pre>
236 66 Etienne Pallier
$ python -V
237 66 Etienne Pallier
Python 3.5.1
238 66 Etienne Pallier
</pre>
239 66 Etienne Pallier
240 62 Etienne Pallier
 * *Automatic Installation of all packages*
241 62 Etienne Pallier
<pre>
242 90 Etienne Pallier
$ pip install -r REQUIREMENTS.txt
243 62 Etienne Pallier
</pre>
244 62 Etienne Pallier
245 93 Etienne Pallier
 * *Or, manual installation of each package*
246 62 Etienne Pallier
247 62 Etienne Pallier
  * *Install Django* :
248 32 Etienne Pallier
<pre>
249 3 Etienne Pallier
$ pip install django
250 3 Etienne Pallier
Collecting django
251 3 Etienne Pallier
  Downloading Django-1.9.4-py2.py3-none-any.whl (6.6MB)
252 3 Etienne Pallier
Installing collected packages: django
253 3 Etienne Pallier
Successfully installed django-1.9.4
254 3 Etienne Pallier
255 3 Etienne Pallier
$ pip install django-admin-tools
256 3 Etienne Pallier
Collecting django-admin-tools
257 3 Etienne Pallier
  Downloading django_admin_tools-0.7.2-py2.py3-none-any.whl (289kB)
258 3 Etienne Pallier
Installing collected packages: django-admin-tools
259 3 Etienne Pallier
Successfully installed django-admin-tools-0.7.2
260 3 Etienne Pallier
261 21 Etienne Pallier
$ pip install django-debug-toolbar
262 21 Etienne Pallier
Collecting django-debug-toolbar
263 21 Etienne Pallier
  Downloading django_debug_toolbar-1.4-py2.py3-none-any.whl (212kB)
264 21 Etienne Pallier
Requirement already satisfied (use --upgrade to upgrade): Django>=1.7 in ./venv_py35_pyros/lib/python3.5/site-packages (from django-debug-toolbar)
265 21 Etienne Pallier
Collecting sqlparse (from django-debug-toolbar)
266 21 Etienne Pallier
  Downloading sqlparse-0.1.19.tar.gz (58kB)
267 21 Etienne Pallier
Building wheels for collected packages: sqlparse
268 21 Etienne Pallier
  Running setup.py bdist_wheel for sqlparse ... done
269 21 Etienne Pallier
  Stored in directory: /Users/epallier/Library/Caches/pip/wheels/7b/d4/72/6011bb100dd5fc213164e4bbee13d4e03261dd54ce6a5de6b8
270 21 Etienne Pallier
Successfully built sqlparse
271 21 Etienne Pallier
Installing collected packages: sqlparse, django-debug-toolbar
272 21 Etienne Pallier
Successfully installed django-debug-toolbar-1.4 sqlparse-0.1.19
273 21 Etienne Pallier
274 21 Etienne Pallier
$ pip install django-extensions
275 21 Etienne Pallier
Collecting django-extensions
276 21 Etienne Pallier
  Downloading django_extensions-1.6.1-py2.py3-none-any.whl (202kB)
277 21 Etienne Pallier
Collecting six>=1.2 (from django-extensions)
278 21 Etienne Pallier
  Downloading six-1.10.0-py2.py3-none-any.whl
279 21 Etienne Pallier
Installing collected packages: six, django-extensions
280 21 Etienne Pallier
Successfully installed django-extensions-1.6.1 six-1.10.0
281 21 Etienne Pallier
282 21 Etienne Pallier
$ pip install django-suit
283 21 Etienne Pallier
Collecting django-suit
284 21 Etienne Pallier
  Downloading django-suit-0.2.18.tar.gz (587kB)
285 21 Etienne Pallier
Building wheels for collected packages: django-suit
286 1 Etienne Pallier
  Running setup.py bdist_wheel for django-suit ... done
287 1 Etienne Pallier
  Stored in directory: /Users/epallier/Library/Caches/pip/wheels/12/8b/9a/e02ab0ad9229881638aa040d47d77c8f562999533811927d41
288 1 Etienne Pallier
Successfully built django-suit
289 1 Etienne Pallier
Installing collected packages: django-suit
290 1 Etienne Pallier
Successfully installed django-suit-0.2.18
291 21 Etienne Pallier
292 32 Etienne Pallier
</pre>
293 32 Etienne Pallier
294 63 Etienne Pallier
  * *Install the web application server gunicorn (will be used in production instead of the dev django web server)* :
295 32 Etienne Pallier
<pre>
296 25 Etienne Pallier
$ pip install gunicorn
297 25 Etienne Pallier
Collecting gunicorn
298 25 Etienne Pallier
  Downloading gunicorn-19.4.5-py2.py3-none-any.whl (112kB)
299 21 Etienne Pallier
Installing collected packages: gunicorn
300 26 Etienne Pallier
Successfully installed gunicorn-19.4.5
301 1 Etienne Pallier
</pre>
302 1 Etienne Pallier
303 63 Etienne Pallier
  * *Install the python mysql client*:
304 32 Etienne Pallier
<pre>
305 32 Etienne Pallier
$ pip install mysqlclient
306 72 Etienne Pallier
...
307 72 Etienne Pallier
</pre>
308 33 Etienne Pallier
309 73 Etienne Pallier
   * => Issue under Mac OS X:
310 72 Etienne Pallier
<pre>
311 3 Etienne Pallier
$ pip install mysqlclient
312 3 Etienne Pallier
Collecting mysqlclient
313 1 Etienne Pallier
  Downloading mysqlclient-1.3.7.tar.gz (79kB)
314 22 Etienne Pallier
Building wheels for collected packages: mysqlclient
315 3 Etienne Pallier
  Running setup.py bdist_wheel for mysqlclient ... error
316 3 Etienne Pallier
317 1 Etienne Pallier
  ----------------------------------------
318 1 Etienne Pallier
  Failed building wheel for mysqlclient
319 1 Etienne Pallier
  Running setup.py clean for mysqlclient
320 1 Etienne Pallier
Failed to build mysqlclient
321 1 Etienne Pallier
Installing collected packages: mysqlclient
322 1 Etienne Pallier
  Running setup.py install for mysqlclient ... done
323 1 Etienne Pallier
Successfully installed mysqlclient-1.3.7
324 1 Etienne Pallier
325 1 Etienne Pallier
BOUH !!!
326 1 Etienne Pallier
327 1 Etienne Pallier
$ pip install --upgrade wheel
328 1 Etienne Pallier
Collecting wheel
329 1 Etienne Pallier
  Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
330 1 Etienne Pallier
Installing collected packages: wheel
331 1 Etienne Pallier
  Found existing installation: wheel 0.24.0
332 1 Etienne Pallier
    Uninstalling wheel-0.24.0:
333 1 Etienne Pallier
      Successfully uninstalled wheel-0.24.0
334 1 Etienne Pallier
Successfully installed wheel-0.29.0
335 1 Etienne Pallier
336 1 Etienne Pallier
$ pip uninstall mysqlclient
337 1 Etienne Pallier
338 1 Etienne Pallier
$ pip install mysqlclient
339 1 Etienne Pallier
Collecting mysqlclient
340 1 Etienne Pallier
  Using cached mysqlclient-1.3.7.tar.gz
341 1 Etienne Pallier
Building wheels for collected packages: mysqlclient
342 1 Etienne Pallier
  Running setup.py bdist_wheel for mysqlclient ... done
343 1 Etienne Pallier
  Stored in directory: /Users/epallier/Library/Caches/pip/wheels/9b/06/50/d11418c26cf8f2156b13d4363b5afde8e7e75ebb8540d0228d
344 1 Etienne Pallier
Successfully built mysqlclient
345 1 Etienne Pallier
Installing collected packages: mysqlclient
346 1 Etienne Pallier
Successfully installed mysqlclient-1.3.7
347 1 Etienne Pallier
348 1 Etienne Pallier
YES !!!
349 1 Etienne Pallier
350 1 Etienne Pallier
</pre>
351 1 Etienne Pallier
352 107 Paul Carensac
   * => Issues under Ubuntu:
353 107 Paul Carensac
<pre>
354 107 Paul Carensac
$ pip install mysqlclient
355 107 Paul Carensac
Collecting mysqlclient
356 107 Paul Carensac
  Downloading mysqlclient-1.3.7.tar.gz (79kB)
357 107 Paul Carensac
    100% |████████████████████████████████| 81kB 1.5MB/s
358 107 Paul Carensac
    Complete output from command python setup.py egg_info:
359 107 Paul Carensac
    /bin/sh: 1: mysql_config: not found
360 107 Paul Carensac
    Traceback (most recent call last):
361 107 Paul Carensac
      File "<string>", line 1, in <module>
362 107 Paul Carensac
    [...]
363 107 Paul Carensac
    ----------------------------------------
364 107 Paul Carensac
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-q6j4inuz/mysqlclient/
365 1 Etienne Pallier
366 108 Paul Carensac
BOUH !!!
367 108 Paul Carensac
368 107 Paul Carensac
$ sudo apt-get install libmysqlclient-dev
369 108 Paul Carensac
370 107 Paul Carensac
$ pip install mysqlclient
371 107 Paul Carensac
Collecting mysqlclient
372 107 Paul Carensac
  Using cached mysqlclient-1.3.7.tar.gz
373 107 Paul Carensac
Building wheels for collected packages: mysqlclient
374 107 Paul Carensac
  Running setup.py bdist_wheel for mysqlclient ... error
375 107 Paul Carensac
376 107 Paul Carensac
    _mysql.c:40:20: fatal error: Python.h: No such file or directory
377 107 Paul Carensac
     #include "Python.h"
378 107 Paul Carensac
                        ^
379 107 Paul Carensac
    compilation terminated.
380 107 Paul Carensac
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
381 107 Paul Carensac
    
382 107 Paul Carensac
    ----------------------------------------
383 107 Paul Carensac
Command "/home/carens_p/pyros/venv_py35_pyros/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-k3klv92j/mysqlclient/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-gz242xxs-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/carens_p/pyros/venv_py35_pyros/include/site/python3.5/mysqlclient" failed with error code 1 in /tmp/pip-build-k3klv92j/mysqlclient/
384 107 Paul Carensac
385 108 Paul Carensac
BOUH !!!
386 108 Paul Carensac
387 107 Paul Carensac
$ sudo apt-get install python3.5-dev
388 108 Paul Carensac
389 107 Paul Carensac
$ pip install mysqlclient
390 107 Paul Carensac
391 107 Paul Carensac
YES !!!
392 107 Paul Carensac
393 107 Paul Carensac
</pre>
394 12 Etienne Pallier
395 82 Etienne Pallier
 * *Set Requirements*
396 82 Etienne Pallier
397 82 Etienne Pallier
<pre>
398 82 Etienne Pallier
$ pip freeze > REQUIREMENTS.txt
399 82 Etienne Pallier
</pre>
400 12 Etienne Pallier
401 12 Etienne Pallier
---
402 28 Etienne Pallier
403 7 Etienne Pallier
h3. Create Django project pyros
404 38 Etienne Pallier
405 38 Etienne Pallier
<pre>
406 1 Etienne Pallier
407 83 Etienne Pallier
From inside the project:
408 83 Etienne Pallier
$ pwd
409 83 Etienne Pallier
.../PYROS/
410 83 Etienne Pallier
411 1 Etienne Pallier
$ django-admin startproject pyros
412 1 Etienne Pallier
413 149 Etienne Pallier
Rename the project folder "pyros/" as "src/"
414 149 Etienne Pallier
415 84 Etienne Pallier
$ mv pyros src
416 84 Etienne Pallier
417 1 Etienne Pallier
We have then this architecture:
418 86 Etienne Pallier
419 86 Etienne Pallier
PYROS
420 172 Etienne Pallier
├── REQUIREMENTS.txt
421 86 Etienne Pallier
├── private
422 137 Etienne Pallier
│   └── venv_py35_pyros
423 83 Etienne Pallier
├── public
424 83 Etienne Pallier
│   └── static
425 83 Etienne Pallier
├── src
426 83 Etienne Pallier
│   ├── manage.py
427 1 Etienne Pallier
│   ├── pyros
428 84 Etienne Pallier
│   │   ├── __init__.py
429 84 Etienne Pallier
│   │   ├── settings.py
430 84 Etienne Pallier
│   │   ├── urls.py
431 1 Etienne Pallier
│   │   └── wsgi.py
432 137 Etienne Pallier
433 142 Etienne Pallier
</pre>
434 3 Etienne Pallier
435 3 Etienne Pallier
436 1 Etienne Pallier
437 142 Etienne Pallier
438 142 Etienne Pallier
---
439 142 Etienne Pallier
440 142 Etienne Pallier
h3. Test the project
441 142 Etienne Pallier
442 142 Etienne Pallier
<pre>
443 142 Etienne Pallier
444 150 Etienne Pallier
$ cd src/
445 150 Etienne Pallier
446 1 Etienne Pallier
$ ./manage.py runserver
447 38 Etienne Pallier
(or gunicorn pyros.wsgi)
448 3 Etienne Pallier
==> http://localhost:8000
449 87 Etienne Pallier
...
450 87 Etienne Pallier
...
451 87 Etienne Pallier
Ctrl-c
452 87 Etienne Pallier
453 1 Etienne Pallier
</pre>
454 142 Etienne Pallier
455 142 Etienne Pallier
456 142 Etienne Pallier
457 142 Etienne Pallier
---
458 142 Etienne Pallier
459 142 Etienne Pallier
h3. The Web server
460 142 Etienne Pallier
461 142 Etienne Pallier
462 142 Etienne Pallier
Apache : gère tous les fichiers statiques (images, html…), et délègue les fichiers python au serveur django (par défaut)
463 142 Etienne Pallier
464 143 Etienne Pallier
Le fichier pyros/urls.py prend le relai pour tout ce qui est django
465 143 Etienne Pallier
466 142 Etienne Pallier
Le moteur web django sera soit du wsgi soit du unicorn
467 142 Etienne Pallier
468 142 Etienne Pallier
Par défaut, 1 seul worker, mais on peut en configurer plusieurs, l’idéal étant de faire "nb coeurs + 1" 
469 142 Etienne Pallier
(le worker maître qui fait le dispatching aux autres)
470 142 Etienne Pallier
471 142 Etienne Pallier
Frontend : Apache ou Ngininx
472 142 Etienne Pallier
473 142 Etienne Pallier
Backend : gunicorn (gère facilement des workers) ou uwsgi
474 142 Etienne Pallier
475 152 Etienne Pallier
<pre>
476 152 Etienne Pallier
$ gunicorn pyros.wsgi
477 1 Etienne Pallier
(à la place de manage runserver => A EVITER EN PROD)
478 152 Etienne Pallier
479 1 Etienne Pallier
Ou encore:
480 1 Etienne Pallier
481 152 Etienne Pallier
$ gunicorn --workers 5 library.wsgi
482 152 Etienne Pallier
</pre>
483 3 Etienne Pallier
484 42 Etienne Pallier
---
485 7 Etienne Pallier
486 3 Etienne Pallier
h3. Set Database engine as MySql
487 3 Etienne Pallier
488 41 Etienne Pallier
Edit src/pyros/settings.py
489 3 Etienne Pallier
490 3 Etienne Pallier
<pre>
491 3 Etienne Pallier
DATABASES = {
492 1 Etienne Pallier
    'default': {
493 3 Etienne Pallier
        'ENGINE': 'django.db.backends.mysql',
494 1 Etienne Pallier
        'NAME': 'pyros',
495 1 Etienne Pallier
        'USER': 'root',
496 1 Etienne Pallier
        'PASSWORD': ''
497 41 Etienne Pallier
    }
498 3 Etienne Pallier
}
499 7 Etienne Pallier
</pre>
500 3 Etienne Pallier
501 43 Etienne Pallier
---
502 7 Etienne Pallier
503 43 Etienne Pallier
h3. Import database into Django (with inspectdb)
504 3 Etienne Pallier
505 101 Etienne Pallier
From src/ :
506 94 Etienne Pallier
507 3 Etienne Pallier
<pre>
508 44 Etienne Pallier
$ ./manage.py inspectdb > models.py
509 94 Etienne Pallier
</pre>
510 44 Etienne Pallier
511 97 Etienne Pallier
Issue on Mac OS X:
512 3 Etienne Pallier
<pre>
513 3 Etienne Pallier
Traceback (most recent call last):
514 3 Etienne Pallier
  File "/Users/epallier/Documents/_W_more/PROJECTS/GFT/SOFT/PYROS/pyros/venv_py35_pyros/lib/python3.5/site-packages/django/db/backends/mysql/base.py", line 25, in <module>
515 3 Etienne Pallier
    import MySQLdb as Database
516 3 Etienne Pallier
  File "/Users/epallier/Documents/_W_more/PROJECTS/GFT/SOFT/PYROS/pyros/venv_py35_pyros/lib/python3.5/site-packages/MySQLdb/__init__.py", line 19, in <module>
517 3 Etienne Pallier
    import _mysql
518 3 Etienne Pallier
ImportError: dlopen(/Users/epallier/Documents/_W_more/PROJECTS/GFT/SOFT/PYROS/pyros/venv_py35_pyros/lib/python3.5/site-packages/_mysql.cpython-35m-darwin.so, 2): Library not loaded: libmysqlclient.18.dylib
519 3 Etienne Pallier
  Referenced from: /Users/epallier/Documents/_W_more/PROJECTS/GFT/SOFT/PYROS/pyros/venv_py35_pyros/lib/python3.5/site-packages/_mysql.cpython-35m-darwin.so
520 3 Etienne Pallier
  Reason: image not found
521 3 Etienne Pallier
522 3 Etienne Pallier
=> BOUH !!!
523 3 Etienne Pallier
524 3 Etienne Pallier
LA SOLUTION EST ICI : http://stackoverflow.com/questions/6383310/python-mysqldb-library-not-loaded-libmysqlclient-18-dylib
525 3 Etienne Pallier
526 124 Etienne Pallier
Il suffit de faire ceci:
527 3 Etienne Pallier
528 124 Etienne Pallier
$ sudo mkdir -p /usr/local/lib   
529 124 Etienne Pallier
$ sudo ln -s /Applications/XAMPP/xamppfiles/lib/libmysql* /usr/local/lib/
530 124 Etienne Pallier
531 124 Etienne Pallier
Mais on peut aussi faire ceci:
532 3 Etienne Pallier
533 123 Etienne Pallier
Okay, so the offending file is /Users/epallier/Documents/_W_more/PROJECTS/GFT/SOFT/PYROS/pyros/venv_py35_pyros/lib/python3.5/site-packages/_mysql.cpython-35m-darwin.so
534 123 Etienne Pallier
535 123 Etienne Pallier
Next, figure out where _mysql.so thinks it should find libmysqlclient.18.dylib:
536 123 Etienne Pallier
537 1 Etienne Pallier
$ otool -L /Users/epallier/Documents/_W_more/PROJECTS/GFT/SOFT/PYROS/pyros/venv_py35_pyros/lib/python3.5/site-packages/_mysql.cpython-35m-darwin.so
538 10 Etienne Pallier
/Users/epallier/Documents/_W_more/PROJECTS/GFT/SOFT/PYROS/pyros/venv_py35_pyros/lib/python3.5/site-packages/_mysql.cpython-35m-darwin.so:
539 3 Etienne Pallier
	libmysqlclient.18.dylib (compatibility version 18.0.0, current version 18.0.0)
540 3 Etienne Pallier
...
541 3 Etienne Pallier
542 123 Etienne Pallier
So, it's looking for libmysqlclient.18.dylib with no path information, let's fix that:
543 123 Etienne Pallier
544 1 Etienne Pallier
$ locate libmysqlclient.18.dylib
545 1 Etienne Pallier
/Applications/XAMPP/xamppfiles/lib/libmysqlclient.18.dylib
546 1 Etienne Pallier
/Library/SystemMigration/History/Migration-68137DFB-CB6A-4FBB-81E2-11BDB5D01E48/QuarantineRoot/usr/lib/libmysqlclient.18.dylib
547 1 Etienne Pallier
548 10 Etienne Pallier
$ sudo install_name_tool -change libmysqlclient.18.dylib /Applications/XAMPP/xamppfiles/lib/libmysqlclient.18.dylib /Users/epallier/Documents/_W_more/PROJECTS/GFT/SOFT/PYROS/pyros/venv_py35_pyros/lib/python3.5/site-packages/_mysql.cpython-35m-darwin.so
549 123 Etienne Pallier
550 123 Etienne Pallier
Now _mysql.so knows the full path to the library and everything works, regardless of environment variables.
551 10 Etienne Pallier
552 10 Etienne Pallier
$ otool -L /Users/epallier/Documents/_W_more/PROJECTS/GFT/SOFT/PYROS/pyros/venv_py35_pyros/lib/python3.5/site-packages/_mysql.cpython-35m-darwin.so
553 10 Etienne Pallier
/Users/epallier/Documents/_W_more/PROJECTS/GFT/SOFT/PYROS/pyros/venv_py35_pyros/lib/python3.5/site-packages/_mysql.cpython-35m-darwin.so:
554 3 Etienne Pallier
	/Applications/XAMPP/xamppfiles/lib/libmysqlclient.18.dylib (compatibility version 18.0.0, current version 18.0.0)
555 1 Etienne Pallier
...
556 1 Etienne Pallier
557 3 Etienne Pallier
$ ./manage.py inspectdb > models.py
558 44 Etienne Pallier
559 3 Etienne Pallier
=> YES !!!
560 3 Etienne Pallier
</pre>
561 7 Etienne Pallier
562 3 Etienne Pallier
563 48 Etienne Pallier
---
564 7 Etienne Pallier
565 3 Etienne Pallier
h3. Create a Django application pyrosapp
566 3 Etienne Pallier
567 102 Etienne Pallier
From src/ :
568 98 Etienne Pallier
569 102 Etienne Pallier
<pre>
570 1 Etienne Pallier
$ ./manage.py startapp pyrosapp
571 1 Etienne Pallier
</pre>
572 1 Etienne Pallier
573 103 Etienne Pallier
We obtain this structure:
574 1 Etienne Pallier
575 103 Etienne Pallier
<pre>
576 104 Etienne Pallier
577 103 Etienne Pallier
PYROS/
578 172 Etienne Pallier
├── REQUIREMENTS.txt
579 1 Etienne Pallier
├── private/
580 153 Etienne Pallier
│   └── venv_py35_pyros/
581 153 Etienne Pallier
├── public/
582 153 Etienne Pallier
│   └── static/
583 103 Etienne Pallier
├── src/
584 103 Etienne Pallier
│   ├── manage.py
585 153 Etienne Pallier
│   ├── pyros/
586 103 Etienne Pallier
│   │   ├── __init__.py
587 103 Etienne Pallier
│   │   ├── __pycache__
588 103 Etienne Pallier
│   │   ├── settings.py
589 103 Etienne Pallier
│   │   ├── urls.py
590 103 Etienne Pallier
│   │   └── wsgi.py
591 153 Etienne Pallier
│   └── pyrosapp/
592 1 Etienne Pallier
│       ├── __init__.py
593 103 Etienne Pallier
│       ├── admin.py
594 103 Etienne Pallier
│       ├── apps.py
595 103 Etienne Pallier
│       ├── migrations
596 103 Etienne Pallier
│       ├── models.py
597 103 Etienne Pallier
│       ├── tests.py
598 103 Etienne Pallier
│       └── views.py
599 153 Etienne Pallier
600 103 Etienne Pallier
601 7 Etienne Pallier
</pre>
602 1 Etienne Pallier
603 7 Etienne Pallier
---
604 7 Etienne Pallier
605 3 Etienne Pallier
h3. Replace the default pyrosapp models.py with the inspectdb generated one
606 3 Etienne Pallier
607 105 Etienne Pallier
From src/ :
608 1 Etienne Pallier
609 105 Etienne Pallier
<pre>
610 105 Etienne Pallier
$ mv models.py pyrosapp/
611 105 Etienne Pallier
</pre>
612 3 Etienne Pallier
613 139 Paul Carensac
Add pyrosapp to the project's applications :
614 7 Etienne Pallier
615 139 Paul Carensac
Edit src/pyros/settings.py
616 1 Etienne Pallier
617 139 Paul Carensac
<pre>
618 139 Paul Carensac
INSTALLED_APPS = [
619 139 Paul Carensac
    'django.contrib.admin',
620 139 Paul Carensac
    'django.contrib.auth',
621 139 Paul Carensac
    'django.contrib.contenttypes',
622 139 Paul Carensac
    'django.contrib.sessions',
623 139 Paul Carensac
    'django.contrib.messages',
624 139 Paul Carensac
    'django.contrib.staticfiles',
625 139 Paul Carensac
    'pyrosapp',
626 139 Paul Carensac
]
627 139 Paul Carensac
</pre>
628 9 Etienne Pallier
629 47 Etienne Pallier
---
630 3 Etienne Pallier
631 145 Paul Carensac
h3. Fix and improve the pyrosapp models.py file (generated by inspectdb)
632 1 Etienne Pallier
633 145 Paul Carensac
Once models.py file generated, we need to delete the database and create an empty one :
634 145 Paul Carensac
 
635 145 Paul Carensac
<pre>
636 145 Paul Carensac
$ mysql -u root [-p (if password needed)]
637 106 Etienne Pallier
638 145 Paul Carensac
mysql> DROP DATABSE pyros
639 145 Paul Carensac
mysql> CREATE SCHEMA IF NOT EXISTS 'pyros' DEFAULT CHARACTER SET utf8;
640 1 Etienne Pallier
641 145 Paul Carensac
</pre>
642 1 Etienne Pallier
643 145 Paul Carensac
Then edit pyrosapp/models.py :
644 1 Etienne Pallier
645 145 Paul Carensac
 * Change 'managed = False' to 'managed = True' for every model
646 145 Paul Carensac
647 145 Paul Carensac
 * Change classes names to CamelCase (do not change the 'db_table = ...' lines). *Be careful* : it is needed to change all occurences :
648 145 Paul Carensac
649 145 Paul Carensac
    * NrtAlanysis
650 145 Paul Carensac
    * ScheduleHistory
651 145 Paul Carensac
    * ScientificProgram
652 145 Paul Carensac
    * SequenceType
653 145 Paul Carensac
    * SiteWatch
654 145 Paul Carensac
    * SiteWatchHistory
655 145 Paul Carensac
    * StrategyObs
656 154 Paul Carensac
    * UserLevel
657 145 Paul Carensac
    * WeatherWatch
658 145 Paul Carensac
    * WeatherWatchHistory
659 145 Paul Carensac
660 145 Paul Carensac
 * Change the deleting mode from 'models.DO_NOTHING' to 'models.CASCADE' for the following foreign keys :
661 145 Paul Carensac
662 145 Paul Carensac
    * Image.plan
663 145 Paul Carensac
    * Plan.album
664 145 Paul Carensac
    * Album.sequence
665 145 Paul Carensac
    * Sequence.request
666 145 Paul Carensac
667 145 Paul Carensac
 * Change the 'ForeignKey' liaisons to 'OneToOneField' liaisons (just replace ForeignKey by OneToOneField), and change deleting mode to 'models.CASCADE' for the following foreign keys :
668 145 Paul Carensac
669 145 Paul Carensac
    * Alert.request
670 145 Paul Carensac
    * Detector.device
671 145 Paul Carensac
    * Filter.device
672 145 Paul Carensac
    * Telescope.device
673 145 Paul Carensac
674 145 Paul Carensac
 * We need to redefine many to many relationships for the following classes :
675 145 Paul Carensac
676 145 Paul Carensac
    * User - ScientificProgram :
677 145 Paul Carensac
678 145 Paul Carensac
        * add 'users = models.ManyToManyField('User')' in ScientificProgram class
679 145 Paul Carensac
        * delete UserHasScientificProgram class
680 145 Paul Carensac
681 145 Paul Carensac
    * Sequence - ScheduleHistory
682 145 Paul Carensac
683 145 Paul Carensac
        * add 'sequences = models.ManyToManyField('Sequence')' in ScheduleHistory class
684 145 Paul Carensac
        * delete ScheduleHasSequences class
685 145 Paul Carensac
686 145 Paul Carensac
 * Finally apply modifications to the database :
687 145 Paul Carensac
688 145 Paul Carensac
<pre>
689 145 Paul Carensac
$ pwd
690 145 Paul Carensac
.../PYROS/src
691 145 Paul Carensac
$ python manage.py makemigrations pyrosapp
692 145 Paul Carensac
$ python manage.py migrate
693 145 Paul Carensac
</pre>
694 109 Etienne Pallier
695 109 Etienne Pallier
---
696 111 Etienne Pallier
697 156 Paul Carensac
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}IV - CONFIGURATION of the Django Back Office (administration interface)%
698 155 Paul Carensac
699 155 Paul Carensac
---
700 155 Paul Carensac
701 155 Paul Carensac
h3. Back Office setup
702 155 Paul Carensac
703 155 Paul Carensac
 * Prerequisites in src/pyros/settings.py :
704 155 Paul Carensac
705 155 Paul Carensac
    * INSTALLED_APPS must (at least) contain :
706 155 Paul Carensac
707 155 Paul Carensac
        * django.contrib.admin
708 155 Paul Carensac
        * django.contrib.auth
709 155 Paul Carensac
        * django.contrib.contenttypes
710 155 Paul Carensac
        * django.contrib.sessions
711 155 Paul Carensac
712 155 Paul Carensac
    * MIDDLEWARES must (at least) contain :
713 155 Paul Carensac
714 155 Paul Carensac
        * django.contrib.sessions.middleware.SessionMiddleware
715 155 Paul Carensac
        * django.middleware.common.CommonMiddleware
716 155 Paul Carensac
        * django.contrib.auth.middleware.AuthenticationMiddleware
717 155 Paul Carensac
718 155 Paul Carensac
 * At least one 'python manage.py migrate' must have been executed
719 155 Paul Carensac
720 155 Paul Carensac
 * Create a superuser for the administration :
721 155 Paul Carensac
722 155 Paul Carensac
<pre>
723 155 Paul Carensac
$ python manage.py createsuperuser
724 155 Paul Carensac
</pre>
725 155 Paul Carensac
726 156 Paul Carensac
* For each app of the project, fill the admin.py file :
727 155 Paul Carensac
728 155 Paul Carensac
<pre>
729 155 Paul Carensac
from django.contrib import admin
730 155 Paul Carensac
from app.models import Model1, Model2
731 155 Paul Carensac
732 155 Paul Carensac
admin.site.register(Model1)
733 155 Paul Carensac
admin.site.register(Model2)
734 155 Paul Carensac
</pre>
735 155 Paul Carensac
736 155 Paul Carensac
*Reminder* : each application must be registered in the settings.py INSTALLED_APPS variable.
737 157 Paul Carensac
738 168 Paul Carensac
* For each model in models.py, add a '__str__()' method in order to identify the object on the back office. Example :
739 157 Paul Carensac
740 157 Paul Carensac
<pre>
741 157 Paul Carensac
class UserLevel(models.Model):
742 157 Paul Carensac
    name = models.CharField(max_length=45, blank=True, null=True)
743 157 Paul Carensac
    desc = models.TextField(blank=True, null=True)
744 157 Paul Carensac
    priority = models.IntegerField(blank=True, null=True)
745 157 Paul Carensac
    quota = models.FloatField(blank=True, null=True)
746 157 Paul Carensac
747 157 Paul Carensac
    class Meta:
748 157 Paul Carensac
        managed = True
749 157 Paul Carensac
        db_table = 'userlevel'
750 157 Paul Carensac
751 157 Paul Carensac
    def __str__(self):
752 163 Paul Carensac
        return (str(self.name))
753 157 Paul Carensac
</pre>
754 157 Paul Carensac
755 159 Paul Carensac
*Naming convention* : Use self.name when possible, the creation time/date otherwise. Example :
756 159 Paul Carensac
757 159 Paul Carensac
<pre>
758 159 Paul Carensac
class SiteWatch(models.Model):
759 159 Paul Carensac
    updated = models.DateTimeField(blank=True, null=True)
760 159 Paul Carensac
    lights = models.CharField(max_length=45, blank=True, null=True)
761 159 Paul Carensac
    dome = models.CharField(max_length=45, blank=True, null=True)
762 159 Paul Carensac
    doors = models.CharField(max_length=45, blank=True, null=True)
763 159 Paul Carensac
    temperature = models.FloatField(blank=True, null=True)
764 159 Paul Carensac
765 159 Paul Carensac
    class Meta:
766 159 Paul Carensac
        managed = True
767 159 Paul Carensac
        db_table = 'sitewatch'
768 159 Paul Carensac
769 159 Paul Carensac
    def __str__(self):
770 160 Paul Carensac
        return (str(self.updated))
771 159 Paul Carensac
</pre>
772 173 Etienne Pallier
773 176 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}V - INSTALLATION FROM THE BEGINNING (for dev only)%
774 173 Etienne Pallier
775 1 Etienne Pallier
776 176 Etienne Pallier
h3. How the git repository was created
777 176 Etienne Pallier
778 176 Etienne Pallier
*Git global setup:*
779 176 Etienne Pallier
780 176 Etienne Pallier
<pre>
781 176 Etienne Pallier
$ git config --global user.name "Etienne Pallier"
782 176 Etienne Pallier
$ git config --global user.email "etienne.pallier@irap.omp.eu"
783 176 Etienne Pallier
784 176 Etienne Pallier
$ cat ~/.gitconfig 
785 176 Etienne Pallier
[user]
786 176 Etienne Pallier
	name = Etienne Pallier
787 176 Etienne Pallier
	email = epallier@irap.omp.eu
788 176 Etienne Pallier
[http]
789 176 Etienne Pallier
	sslVerify = false
790 176 Etienne Pallier
</pre>
791 176 Etienne Pallier
792 176 Etienne Pallier
793 176 Etienne Pallier
*Create a new repository:*
794 176 Etienne Pallier
795 176 Etienne Pallier
<pre>
796 176 Etienne Pallier
$ cd PYROS/
797 176 Etienne Pallier
798 176 Etienne Pallier
Define files and folders to be ignored:
799 176 Etienne Pallier
$ vi .gitignore
800 176 Etienne Pallier
.DS_Store
801 176 Etienne Pallier
private
802 176 Etienne Pallier
__pycache__
803 176 Etienne Pallier
804 176 Etienne Pallier
$ touch README.md
805 176 Etienne Pallier
806 176 Etienne Pallier
$ git add README.md
807 176 Etienne Pallier
808 176 Etienne Pallier
$ git commit -m "first commit"
809 176 Etienne Pallier
810 176 Etienne Pallier
$ git remote add origin https://gitlab.irap.omp.eu/epallier/pyros.git
811 176 Etienne Pallier
812 176 Etienne Pallier
$ git push -u origin master
813 176 Etienne Pallier
814 176 Etienne Pallier
$ git add .
815 176 Etienne Pallier
816 176 Etienne Pallier
( if you want to be sure to add ALL files: 
817 176 Etienne Pallier
$ git add -A
818 176 Etienne Pallier
)
819 176 Etienne Pallier
820 176 Etienne Pallier
( if you wanted to remove added files, just type:
821 176 Etienne Pallier
$ git reset HEAD
822 176 Etienne Pallier
)
823 176 Etienne Pallier
824 176 Etienne Pallier
$ git commit -m "first full project commit"
825 176 Etienne Pallier
826 176 Etienne Pallier
$ git push -u origin master
827 176 Etienne Pallier
Counting objects: 43, done.
828 176 Etienne Pallier
Delta compression using up to 4 threads.
829 176 Etienne Pallier
Compressing objects: 100% (41/41), done.
830 176 Etienne Pallier
Writing objects: 100% (43/43), 575.13 KiB ö 0 bytes/s, done.
831 176 Etienne Pallier
Total 43 (delta 2), reused 0 (delta 0)
832 176 Etienne Pallier
To https://gitlab.irap.omp.eu/epallier/pyros.git
833 176 Etienne Pallier
   9c7128c..64501c9  master -> master
834 176 Etienne Pallier
Branch master set up to track remote branch master from origin.
835 176 Etienne Pallier
836 176 Etienne Pallier
$ git status
837 176 Etienne Pallier
On branch master
838 176 Etienne Pallier
Your branch is up-to-date with 'origin/master'.
839 176 Etienne Pallier
nothing to commit, working directory clean
840 176 Etienne Pallier
841 182 Etienne Pallier
</pre>
842 176 Etienne Pallier
843 182 Etienne Pallier
844 182 Etienne Pallier
h3. Create database
845 182 Etienne Pallier
846 182 Etienne Pallier
847 182 Etienne Pallier
 * Linux and Mac OS X:
848 182 Etienne Pallier
<pre>
849 182 Etienne Pallier
One liner:
850 182 Etienne Pallier
$ mysql -u root < pyros_create.sql
851 182 Etienne Pallier
852 182 Etienne Pallier
Or :
853 182 Etienne Pallier
$ mysql -u root
854 182 Etienne Pallier
mysql> create database pyros;
855 182 Etienne Pallier
mysql> use pyros;
856 182 Etienne Pallier
mysql> source pyros_create.sql;
857 182 Etienne Pallier
858 182 Etienne Pallier
(
859 182 Etienne Pallier
TODO:
860 182 Etienne Pallier
mysql> grant all on pyros.* to pyros@localhost identified by ‘pyros’;)
861 182 Etienne Pallier
mysql> flush privileges;
862 182 Etienne Pallier
)
863 176 Etienne Pallier
</pre>
864 182 Etienne Pallier
865 182 Etienne Pallier
866 182 Etienne Pallier
 * Windows:
867 182 Etienne Pallier
<pre>
868 182 Etienne Pallier
TODO: Use phpmyadmin ?
869 182 Etienne Pallier
</pre>
870 182 Etienne Pallier
871 182 Etienne Pallier
872 182 Etienne Pallier
---