Wiki

Version 292 (Etienne Pallier, 03/24/2016 12:15 pm)

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 282 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}TODO%
12 121 Etienne Pallier
13 273 Etienne Pallier
 * Mettre en place une collaboration via le gitlab
14 273 Etienne Pallier
15 251 Etienne Pallier
 * Séparation des BD Django et Pyros
16 1 Etienne Pallier
17 1 Etienne Pallier
 * Intégration des modules Django déjà développés
18 271 Etienne Pallier
19 271 Etienne Pallier
 * Intégration continue avec Jenkins (+ run des tests sur une VM Windows)
20 271 Etienne Pallier
21 272 Etienne Pallier
 * Planifier la suite...
22 272 Etienne Pallier
23 272 Etienne Pallier
 * Doc pour le meeting de mai
24 283 Etienne Pallier
25 283 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}LIENS UTILES%
26 283 Etienne Pallier
27 281 Etienne Pallier
 * Liens vers web local :
28 281 Etienne Pallier
29 280 Etienne Pallier
  * homepage: http://localhost:8000
30 280 Etienne Pallier
  * admin: http://localhost:8000/admin
31 1 Etienne Pallier
32 292 Etienne Pallier
 * Django:
33 292 Etienne Pallier
34 292 Etienne Pallier
  * Coding style: https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/coding-style/
35 292 Etienne Pallier
36 290 Etienne Pallier
 * Git docs: 
37 290 Etienne Pallier
38 290 Etienne Pallier
  * https://git-scm.com/docs
39 290 Etienne Pallier
  * https://git-scm.com/book/fr/v1/Les-bases-de-Git-Travailler-avec-des-d%C3%A9p%C3%B4ts-distants
40 289 Etienne Pallier
41 288 Etienne Pallier
 * CADOR web interface: http://cador.obs-hp.fr/ros/manual/cador_actions.html
42 288 Etienne Pallier
43 284 Etienne Pallier
 * pylint (analyse de code) : https://www.pylint.org
44 284 Etienne Pallier
45 284 Etienne Pallier
 * pyreverse (uml diagrams generation, inclus dans pylint) : https://www.logilab.org/blogentry/6883
46 121 Etienne Pallier
47 291 Etienne Pallier
 * tox (a generic virtualenv management and test command line tool) : https://testrun.org/tox/latest/index.html
48 291 Etienne Pallier
49 3 Etienne Pallier
---
50 1 Etienne Pallier
51 140 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}I - DATABASE SCHEMA (v0.2.1)%
52 116 Etienne Pallier
53 116 Etienne Pallier
54 117 Etienne Pallier
{{thumbnail(PYROS_PDM_v021.png, size=300, title=Pyros data model)}}
55 121 Etienne Pallier
56 121 Etienne Pallier
57 121 Etienne Pallier
---
58 116 Etienne Pallier
59 141 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}II - Get the project (from gitlab)%
60 141 Etienne Pallier
61 277 Etienne Pallier
h3. Gitlab management interface
62 277 Etienne Pallier
63 287 Etienne Pallier
https://gitlab.irap.omp.eu/epallier/pyros
64 287 Etienne Pallier
65 285 Etienne Pallier
https://gitlab.irap.omp.eu/epallier/pyros/team
66 285 Etienne Pallier
67 287 Etienne Pallier
Browse the code: https://gitlab.irap.omp.eu/epallier/pyros/tree/master
68 285 Etienne Pallier
69 253 Etienne Pallier
h3. Project structure
70 1 Etienne Pallier
71 253 Etienne Pallier
Once you have fetched the project, you should obtain this structure:
72 1 Etienne Pallier
73 226 Etienne Pallier
<pre>
74 1 Etienne Pallier
75 1 Etienne Pallier
PYROS/
76 254 Etienne Pallier
├── install/
77 254 Etienne Pallier
│   └── REQUIREMENTS.txt
78 254 Etienne Pallier
│   └── INSTALLATION.txt
79 226 Etienne Pallier
├── public/
80 226 Etienne Pallier
│   └── static/
81 226 Etienne Pallier
├── src/
82 226 Etienne Pallier
│   ├── manage.py
83 226 Etienne Pallier
│   ├── pyros/
84 226 Etienne Pallier
│   │   ├── __init__.py
85 226 Etienne Pallier
│   │   ├── __pycache__
86 226 Etienne Pallier
│   │   ├── settings.py
87 1 Etienne Pallier
│   │   ├── urls.py
88 1 Etienne Pallier
│   │   └── wsgi.py
89 1 Etienne Pallier
│   └── pyrosapp/
90 1 Etienne Pallier
│       ├── __init__.py
91 1 Etienne Pallier
│       ├── admin.py
92 1 Etienne Pallier
│       ├── apps.py
93 1 Etienne Pallier
│       ├── migrations
94 1 Etienne Pallier
│       ├── models.py
95 1 Etienne Pallier
│       ├── tests.py
96 1 Etienne Pallier
│       └── views.py
97 1 Etienne Pallier
98 1 Etienne Pallier
99 253 Etienne Pallier
</pre>
100 253 Etienne Pallier
101 265 Etienne Pallier
h3. From the terminal
102 253 Etienne Pallier
103 253 Etienne Pallier
<pre>
104 253 Etienne Pallier
git clone https://gitlab.irap.omp.eu/epallier/pyros.git PYROS
105 256 Etienne Pallier
(or also : git clone git@gitlab.irap.omp.eu:epallier/pyros.git PYROS)
106 253 Etienne Pallier
</pre>
107 255 Etienne Pallier
108 253 Etienne Pallier
This creates a PYROS/ folder containing the project (with a .git/ subfolder for synchronization with the git repository)
109 253 Etienne Pallier
110 257 Etienne Pallier
_If you just wanted a static copy of the project (without synchronization), just remove the .git/ folder:_
111 253 Etienne Pallier
<pre>
112 253 Etienne Pallier
$ rm -r .git/
113 253 Etienne Pallier
</pre>
114 226 Etienne Pallier
115 264 Etienne Pallier
h3. From Eclipse
116 1 Etienne Pallier
117 274 Paul Carensac
1) Deactivate CA certificate verification
118 1 Etienne Pallier
119 274 Paul Carensac
Window -> Preferences -> Team -> git -> configuration -> Add entry
120 274 Paul Carensac
121 274 Paul Carensac
Key = http.sslVerify
122 274 Paul Carensac
Value = false
123 274 Paul Carensac
124 274 Paul Carensac
2) Fetch the project
125 274 Paul Carensac
126 252 Etienne Pallier
File/Import project from git
127 1 Etienne Pallier
128 258 Etienne Pallier
Select repository source: Clone URI: https://gitlab.irap.omp.eu/epallier/pyros.git
129 252 Etienne Pallier
130 252 Etienne Pallier
Directory: 
131 252 Etienne Pallier
par défaut, il propose : /Users/epallier/git/pyros
132 258 Etienne Pallier
mais on peut le mettre ailleurs (c'est ce que j'ai fait)
133 252 Etienne Pallier
134 1 Etienne Pallier
initial branch: master
135 1 Etienne Pallier
remote name: origin
136 1 Etienne Pallier
137 252 Etienne Pallier
Import as general project
138 252 Etienne Pallier
139 252 Etienne Pallier
Project name: PYROS
140 1 Etienne Pallier
141 258 Etienne Pallier
142 274 Paul Carensac
3) Configure the project
143 258 Etienne Pallier
144 252 Etienne Pallier
The project is created. Now, you have to set it as a «PyDev » and a « Django » project.
145 252 Etienne Pallier
146 252 Etienne Pallier
clic droit sur le projet / PyDev / set as a PyDev project
147 252 Etienne Pallier
148 1 Etienne Pallier
clic droit sur le projet / PyDev / set as a Django project
149 1 Etienne Pallier
150 252 Etienne Pallier
clic droit sur le projet : on doit maintenant avoir un sous-menu Django
151 252 Etienne Pallier
152 252 Etienne Pallier
clic droit sur le dossier src / PyDev / set as source folder (add to PYTHONPATH)
153 252 Etienne Pallier
154 258 Etienne Pallier
clic droit sur projet / Properties / Pydev-Django :
155 252 Etienne Pallier
  - Django manage.py : src/manage.py
156 1 Etienne Pallier
  - Django settings module : pyros.settings
157 258 Etienne Pallier
158 258 Etienne Pallier
159 275 Paul Carensac
4) Set Code style
160 252 Etienne Pallier
161 252 Etienne Pallier
Window/Preferences : Pydev / Editor
162 252 Etienne Pallier
- Auto Imports : uncheck « Do auto import »
163 252 Etienne Pallier
- Code style:
164 252 Etienne Pallier
	- Locals … : camelCase
165 252 Etienne Pallier
	- Methods : camelCase() with first lower
166 1 Etienne Pallier
- Code style / Code Formatter: activer « use autopep8.py for code formatting »
167 264 Etienne Pallier
- Tabs : Tab length : 4
168 264 Etienne Pallier
169 264 Etienne Pallier
(il faudra aussi faire un peu plus loin : https://projects.irap.omp.eu/projects/pyros/wiki/Wiki#Eclipse-only-Set-the-Python3-virtual-environment-as-the-project-interpreter)
170 169 Etienne Pallier
171 141 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}III - INSTALLATION%
172 2 Etienne Pallier
173 120 Etienne Pallier
174 120 Etienne Pallier
---
175 120 Etienne Pallier
176 184 Etienne Pallier
h3. Install MySql (only if necessary)
177 2 Etienne Pallier
178 49 Etienne Pallier
 * Linux Ubuntu
179 49 Etienne Pallier
<pre>
180 107 Paul Carensac
181 107 Paul Carensac
$ sudo apt-get install mysql-server
182 107 Paul Carensac
$ sudo apt-get install mysql-client
183 107 Paul Carensac
184 49 Etienne Pallier
</pre>
185 49 Etienne Pallier
186 49 Etienne Pallier
 * Linux CentOS
187 49 Etienne Pallier
<pre>
188 49 Etienne Pallier
TODO:
189 49 Etienne Pallier
$ sudo yum install mysql
190 49 Etienne Pallier
...
191 49 Etienne Pallier
</pre>
192 49 Etienne Pallier
193 49 Etienne Pallier
 * Mac OS X
194 1 Etienne Pallier
Install XAMPP
195 1 Etienne Pallier
(but you could also use the pre-installed Mac OS MySql)
196 177 Etienne Pallier
<pre>
197 177 Etienne Pallier
TODO:
198 49 Etienne Pallier
</pre>
199 1 Etienne Pallier
200 49 Etienne Pallier
 * Windows
201 243 Paul Carensac
202 1 Etienne Pallier
<pre>
203 243 Paul Carensac
Download and install the newest version on https://dev.mysql.com/downloads/installer/
204 243 Paul Carensac
205 243 Paul Carensac
Once installed, launch MySQL Installer. Clic on 'Add...' on the right.
206 243 Paul Carensac
In MySQLServers section, choose the newest, then clic on next.
207 243 Paul Carensac
Install and configure the server (just follow the installation guide).
208 243 Paul Carensac
209 243 Paul Carensac
Then launch mysql (via the Windows menu).
210 49 Etienne Pallier
</pre>
211 49 Etienne Pallier
212 49 Etienne Pallier
213 49 Etienne Pallier
---
214 1 Etienne Pallier
215 185 Etienne Pallier
h3. Install Python3.5 (only if necessary)
216 1 Etienne Pallier
217 11 Etienne Pallier
218 11 Etienne Pallier
 * Mac OS X :
219 1 Etienne Pallier
<pre>
220 183 Etienne Pallier
221 24 Etienne Pallier
1) Installer MacPort
222 24 Etienne Pallier
(TODO: doc)
223 24 Etienne Pallier
224 24 Etienne Pallier
2) Installer le "port" python35
225 1 Etienne Pallier
$ sudo port install python35
226 183 Etienne Pallier
227 1 Etienne Pallier
</pre>
228 1 Etienne Pallier
229 1 Etienne Pallier
 * Linux (Ubuntu) :
230 1 Etienne Pallier
<pre>
231 244 Paul Carensac
$ sudo add-apt-repository ppa:fkrull/deadsnakes
232 244 Paul Carensac
$ sudo apt-get update
233 244 Paul Carensac
$ sudo apt-get install python3.5
234 1 Etienne Pallier
235 244 Paul Carensac
$ sudo pip install virtualenv
236 1 Etienne Pallier
</pre>
237 1 Etienne Pallier
238 244 Paul Carensac
239 244 Paul Carensac
 * Windows 7 :
240 244 Paul Carensac
<pre>
241 244 Paul Carensac
Go to https://www.python.org/downloads/windows/ , choose the wanted version
242 244 Paul Carensac
On the wanted version’s page, download Windows x86 executable installer
243 244 Paul Carensac
244 244 Paul Carensac
Run the executable
245 244 Paul Carensac
    * On the first page, check "Add python3.5 to PATH"
246 244 Paul Carensac
    * Choose "Install now" option
247 245 Paul Carensac
248 245 Paul Carensac
Open cmd (windows + R, cmd) :
249 245 Paul Carensac
 $ python -m pip install --upgrade pip
250 245 Paul Carensac
 $ pip install virtualenv
251 244 Paul Carensac
</pre>
252 1 Etienne Pallier
253 183 Etienne Pallier
 * Windows 10 :
254 183 Etienne Pallier
<pre>
255 187 Etienne Pallier
TODO:
256 183 Etienne Pallier
</pre>
257 3 Etienne Pallier
258 4 Etienne Pallier
---
259 5 Etienne Pallier
260 192 Etienne Pallier
h3. Create a Python3 virtual environment dedicated to the project (inside the project folder)
261 127 Etienne Pallier
262 131 Etienne Pallier
<pre>
263 1 Etienne Pallier
264 193 Etienne Pallier
$ mkdir private/
265 193 Etienne Pallier
266 133 Etienne Pallier
$ cd private/
267 3 Etienne Pallier
268 246 Paul Carensac
$ which python3.5 ("where python" for windows)
269 3 Etienne Pallier
/opt/local/bin/python3.5
270 15 Etienne Pallier
271 127 Etienne Pallier
$ virtualenv-3.5 venv_py35_pyros -p /opt/local/bin/python3.5
272 3 Etienne Pallier
=> creates a venv_py35_pyros/ folder inside PYROS/private/
273 1 Etienne Pallier
274 131 Etienne Pallier
</pre>
275 1 Etienne Pallier
276 7 Etienne Pallier
---
277 3 Etienne Pallier
278 65 Etienne Pallier
h3. Activate the python virtual environment (from inside the project)
279 7 Etienne Pallier
280 55 Etienne Pallier
<pre>
281 1 Etienne Pallier
282 65 Etienne Pallier
$ pwd
283 134 Etienne Pallier
.../PYROS/private
284 1 Etienne Pallier
285 247 Paul Carensac
$ source ./venv_py35_pyros/bin/activate (venv_py35_pyros/Scripts/activate on Windows)
286 247 Paul Carensac
287 65 Etienne Pallier
288 3 Etienne Pallier
$ python -V
289 1 Etienne Pallier
Python 3.5.1
290 3 Etienne Pallier
291 3 Etienne Pallier
$ which pip
292 77 Etienne Pallier
.../PYROS/venv_py35_pyros/bin/pip
293 16 Etienne Pallier
294 194 Etienne Pallier
Upgrade pip to last version available:
295 3 Etienne Pallier
$ pip install --upgrade pip
296 3 Etienne Pallier
Collecting pip
297 3 Etienne Pallier
  Downloading pip-8.1.1-py2.py3-none-any.whl (1.2MB)
298 3 Etienne Pallier
Installing collected packages: pip
299 3 Etienne Pallier
  Found existing installation: pip 7.1.2
300 3 Etienne Pallier
    Uninstalling pip-7.1.2:
301 3 Etienne Pallier
      Successfully uninstalled pip-7.1.2
302 1 Etienne Pallier
Successfully installed pip-8.1.1
303 194 Etienne Pallier
304 194 Etienne Pallier
Upgrade wheel to last version available:
305 194 Etienne Pallier
$ pip install --upgrade wheel
306 194 Etienne Pallier
Collecting wheel
307 194 Etienne Pallier
  Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
308 194 Etienne Pallier
Installing collected packages: wheel
309 194 Etienne Pallier
  Found existing installation: wheel 0.24.0
310 194 Etienne Pallier
    Uninstalling wheel-0.24.0:
311 194 Etienne Pallier
      Successfully uninstalled wheel-0.24.0
312 194 Etienne Pallier
Successfully installed wheel-0.29.0
313 194 Etienne Pallier
314 55 Etienne Pallier
315 55 Etienne Pallier
</pre>
316 18 Etienne Pallier
317 267 Etienne Pallier
---
318 267 Etienne Pallier
319 212 Etienne Pallier
h3. Install the needed Python packages (from within the virtual environment)
320 18 Etienne Pallier
321 66 Etienne Pallier
First, be sure that the virtual environment is activated:
322 66 Etienne Pallier
<pre>
323 66 Etienne Pallier
$ python -V
324 66 Etienne Pallier
Python 3.5.1
325 66 Etienne Pallier
</pre>
326 66 Etienne Pallier
327 62 Etienne Pallier
 * *Automatic Installation of all packages*
328 62 Etienne Pallier
<pre>
329 90 Etienne Pallier
$ pip install -r REQUIREMENTS.txt
330 62 Etienne Pallier
</pre>
331 62 Etienne Pallier
332 93 Etienne Pallier
 * *Or, manual installation of each package*
333 62 Etienne Pallier
334 62 Etienne Pallier
  * *Install Django* :
335 32 Etienne Pallier
<pre>
336 3 Etienne Pallier
$ pip install django
337 3 Etienne Pallier
Collecting django
338 3 Etienne Pallier
  Downloading Django-1.9.4-py2.py3-none-any.whl (6.6MB)
339 3 Etienne Pallier
Installing collected packages: django
340 3 Etienne Pallier
Successfully installed django-1.9.4
341 3 Etienne Pallier
342 3 Etienne Pallier
$ pip install django-admin-tools
343 3 Etienne Pallier
Collecting django-admin-tools
344 3 Etienne Pallier
  Downloading django_admin_tools-0.7.2-py2.py3-none-any.whl (289kB)
345 3 Etienne Pallier
Installing collected packages: django-admin-tools
346 3 Etienne Pallier
Successfully installed django-admin-tools-0.7.2
347 3 Etienne Pallier
348 21 Etienne Pallier
$ pip install django-debug-toolbar
349 21 Etienne Pallier
Collecting django-debug-toolbar
350 21 Etienne Pallier
  Downloading django_debug_toolbar-1.4-py2.py3-none-any.whl (212kB)
351 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)
352 21 Etienne Pallier
Collecting sqlparse (from django-debug-toolbar)
353 21 Etienne Pallier
  Downloading sqlparse-0.1.19.tar.gz (58kB)
354 21 Etienne Pallier
Building wheels for collected packages: sqlparse
355 21 Etienne Pallier
  Running setup.py bdist_wheel for sqlparse ... done
356 21 Etienne Pallier
  Stored in directory: /Users/epallier/Library/Caches/pip/wheels/7b/d4/72/6011bb100dd5fc213164e4bbee13d4e03261dd54ce6a5de6b8
357 21 Etienne Pallier
Successfully built sqlparse
358 21 Etienne Pallier
Installing collected packages: sqlparse, django-debug-toolbar
359 21 Etienne Pallier
Successfully installed django-debug-toolbar-1.4 sqlparse-0.1.19
360 21 Etienne Pallier
361 21 Etienne Pallier
$ pip install django-extensions
362 21 Etienne Pallier
Collecting django-extensions
363 21 Etienne Pallier
  Downloading django_extensions-1.6.1-py2.py3-none-any.whl (202kB)
364 21 Etienne Pallier
Collecting six>=1.2 (from django-extensions)
365 21 Etienne Pallier
  Downloading six-1.10.0-py2.py3-none-any.whl
366 21 Etienne Pallier
Installing collected packages: six, django-extensions
367 21 Etienne Pallier
Successfully installed django-extensions-1.6.1 six-1.10.0
368 21 Etienne Pallier
369 21 Etienne Pallier
$ pip install django-suit
370 21 Etienne Pallier
Collecting django-suit
371 21 Etienne Pallier
  Downloading django-suit-0.2.18.tar.gz (587kB)
372 21 Etienne Pallier
Building wheels for collected packages: django-suit
373 1 Etienne Pallier
  Running setup.py bdist_wheel for django-suit ... done
374 1 Etienne Pallier
  Stored in directory: /Users/epallier/Library/Caches/pip/wheels/12/8b/9a/e02ab0ad9229881638aa040d47d77c8f562999533811927d41
375 1 Etienne Pallier
Successfully built django-suit
376 1 Etienne Pallier
Installing collected packages: django-suit
377 1 Etienne Pallier
Successfully installed django-suit-0.2.18
378 21 Etienne Pallier
379 32 Etienne Pallier
</pre>
380 32 Etienne Pallier
381 63 Etienne Pallier
  * *Install the web application server gunicorn (will be used in production instead of the dev django web server)* :
382 32 Etienne Pallier
<pre>
383 25 Etienne Pallier
$ pip install gunicorn
384 25 Etienne Pallier
Collecting gunicorn
385 25 Etienne Pallier
  Downloading gunicorn-19.4.5-py2.py3-none-any.whl (112kB)
386 21 Etienne Pallier
Installing collected packages: gunicorn
387 26 Etienne Pallier
Successfully installed gunicorn-19.4.5
388 1 Etienne Pallier
</pre>
389 1 Etienne Pallier
390 63 Etienne Pallier
  * *Install the python mysql client*:
391 32 Etienne Pallier
<pre>
392 32 Etienne Pallier
$ pip install mysqlclient
393 72 Etienne Pallier
...
394 72 Etienne Pallier
</pre>
395 33 Etienne Pallier
396 73 Etienne Pallier
   * => Issue under Mac OS X:
397 72 Etienne Pallier
<pre>
398 3 Etienne Pallier
$ pip install mysqlclient
399 3 Etienne Pallier
Collecting mysqlclient
400 1 Etienne Pallier
  Downloading mysqlclient-1.3.7.tar.gz (79kB)
401 22 Etienne Pallier
Building wheels for collected packages: mysqlclient
402 3 Etienne Pallier
  Running setup.py bdist_wheel for mysqlclient ... error
403 3 Etienne Pallier
404 1 Etienne Pallier
  ----------------------------------------
405 1 Etienne Pallier
  Failed building wheel for mysqlclient
406 1 Etienne Pallier
  Running setup.py clean for mysqlclient
407 1 Etienne Pallier
Failed to build mysqlclient
408 1 Etienne Pallier
Installing collected packages: mysqlclient
409 1 Etienne Pallier
  Running setup.py install for mysqlclient ... done
410 1 Etienne Pallier
Successfully installed mysqlclient-1.3.7
411 1 Etienne Pallier
412 1 Etienne Pallier
BOUH !!!
413 1 Etienne Pallier
414 1 Etienne Pallier
$ pip install --upgrade wheel
415 1 Etienne Pallier
Collecting wheel
416 1 Etienne Pallier
  Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
417 1 Etienne Pallier
Installing collected packages: wheel
418 1 Etienne Pallier
  Found existing installation: wheel 0.24.0
419 1 Etienne Pallier
    Uninstalling wheel-0.24.0:
420 1 Etienne Pallier
      Successfully uninstalled wheel-0.24.0
421 1 Etienne Pallier
Successfully installed wheel-0.29.0
422 1 Etienne Pallier
423 1 Etienne Pallier
$ pip uninstall mysqlclient
424 1 Etienne Pallier
425 1 Etienne Pallier
$ pip install mysqlclient
426 1 Etienne Pallier
Collecting mysqlclient
427 1 Etienne Pallier
  Using cached mysqlclient-1.3.7.tar.gz
428 1 Etienne Pallier
Building wheels for collected packages: mysqlclient
429 1 Etienne Pallier
  Running setup.py bdist_wheel for mysqlclient ... done
430 1 Etienne Pallier
  Stored in directory: /Users/epallier/Library/Caches/pip/wheels/9b/06/50/d11418c26cf8f2156b13d4363b5afde8e7e75ebb8540d0228d
431 1 Etienne Pallier
Successfully built mysqlclient
432 1 Etienne Pallier
Installing collected packages: mysqlclient
433 1 Etienne Pallier
Successfully installed mysqlclient-1.3.7
434 1 Etienne Pallier
435 1 Etienne Pallier
YES !!!
436 1 Etienne Pallier
437 1 Etienne Pallier
</pre>
438 1 Etienne Pallier
439 107 Paul Carensac
   * => Issues under Ubuntu:
440 107 Paul Carensac
<pre>
441 107 Paul Carensac
$ pip install mysqlclient
442 107 Paul Carensac
Collecting mysqlclient
443 107 Paul Carensac
  Downloading mysqlclient-1.3.7.tar.gz (79kB)
444 107 Paul Carensac
    100% |████████████████████████████████| 81kB 1.5MB/s
445 107 Paul Carensac
    Complete output from command python setup.py egg_info:
446 107 Paul Carensac
    /bin/sh: 1: mysql_config: not found
447 107 Paul Carensac
    Traceback (most recent call last):
448 107 Paul Carensac
      File "<string>", line 1, in <module>
449 107 Paul Carensac
    [...]
450 107 Paul Carensac
    ----------------------------------------
451 107 Paul Carensac
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-q6j4inuz/mysqlclient/
452 1 Etienne Pallier
453 108 Paul Carensac
BOUH !!!
454 108 Paul Carensac
455 107 Paul Carensac
$ sudo apt-get install libmysqlclient-dev
456 108 Paul Carensac
457 107 Paul Carensac
$ pip install mysqlclient
458 107 Paul Carensac
Collecting mysqlclient
459 107 Paul Carensac
  Using cached mysqlclient-1.3.7.tar.gz
460 107 Paul Carensac
Building wheels for collected packages: mysqlclient
461 107 Paul Carensac
  Running setup.py bdist_wheel for mysqlclient ... error
462 107 Paul Carensac
463 107 Paul Carensac
    _mysql.c:40:20: fatal error: Python.h: No such file or directory
464 107 Paul Carensac
     #include "Python.h"
465 107 Paul Carensac
                        ^
466 107 Paul Carensac
    compilation terminated.
467 107 Paul Carensac
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
468 107 Paul Carensac
    
469 107 Paul Carensac
    ----------------------------------------
470 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/
471 107 Paul Carensac
472 108 Paul Carensac
BOUH !!!
473 108 Paul Carensac
474 107 Paul Carensac
$ sudo apt-get install python3.5-dev
475 108 Paul Carensac
476 107 Paul Carensac
$ pip install mysqlclient
477 107 Paul Carensac
478 107 Paul Carensac
YES !!!
479 107 Paul Carensac
480 107 Paul Carensac
</pre>
481 12 Etienne Pallier
482 250 Paul Carensac
 * => Issue under Windows
483 250 Paul Carensac
<pre>
484 250 Paul Carensac
Same message as the issue for Mac.
485 250 Paul Carensac
486 250 Paul Carensac
Go to http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient to download the newest mysqlclient wheel
487 250 Paul Carensac
488 250 Paul Carensac
$ pip install path\to\mysqlclient\wheel
489 250 Paul Carensac
490 250 Paul Carensac
No need to redo "pip install mysqlclient"
491 250 Paul Carensac
</pre>
492 250 Paul Carensac
493 12 Etienne Pallier
---
494 28 Etienne Pallier
495 262 Etienne Pallier
h3. (Eclipse only) Set the Python3 virtual environment as the project interpreter
496 260 Etienne Pallier
497 260 Etienne Pallier
clic droit sur projet / Properties / PyDev - Interpreter/Grammar :
498 260 Etienne Pallier
Grammar version : 3
499 276 Paul Carensac
500 260 Etienne Pallier
Interpreter : click on « click here to configure an interpreter not listed »
501 276 Paul Carensac
502 260 Etienne Pallier
click on « New » :
503 260 Etienne Pallier
- Interpreter name : venv_py35_pyros
504 260 Etienne Pallier
- Interpreter executable : click on « Browse »
505 260 Etienne Pallier
	Select your private/venv_py35_pyros/bin/python3.5 executable
506 260 Etienne Pallier
	click OK
507 260 Etienne Pallier
	click OK again
508 260 Etienne Pallier
509 260 Etienne Pallier
Interpreter: select now venv_py35_pyros from the list
510 260 Etienne Pallier
511 266 Etienne Pallier
---
512 266 Etienne Pallier
513 270 Etienne Pallier
h3. Run the project
514 142 Etienne Pallier
515 270 Etienne Pallier
TODO: more details... (notamment sur localhost:8000/admin)
516 1 Etienne Pallier
517 270 Etienne Pallier
h4. From the terminal
518 270 Etienne Pallier
519 142 Etienne Pallier
<pre>
520 142 Etienne Pallier
521 150 Etienne Pallier
$ cd src/
522 150 Etienne Pallier
523 1 Etienne Pallier
$ ./manage.py runserver
524 38 Etienne Pallier
(or gunicorn pyros.wsgi)
525 3 Etienne Pallier
==> http://localhost:8000
526 87 Etienne Pallier
...
527 87 Etienne Pallier
...
528 87 Etienne Pallier
Ctrl-c
529 87 Etienne Pallier
530 1 Etienne Pallier
</pre>
531 270 Etienne Pallier
532 270 Etienne Pallier
h4. From Eclipse
533 270 Etienne Pallier
534 286 Paul Carensac
Right clic on project -> Django/Custom command/runserver
535 286 Paul Carensac
536 286 Paul Carensac
Error on Ubuntu :
537 286 Paul Carensac
538 286 Paul Carensac
<pre>
539 286 Paul Carensac
540 286 Paul Carensac
Traceback (most recent call last):
541 286 Paul Carensac
  File "/home/carens_p/git/pyros/src/manage.py", line 8, in <module>
542 286 Paul Carensac
    from django.core.management import execute_from_command_line
543 286 Paul Carensac
ImportError: No module named 'django'
544 286 Paul Carensac
545 286 Paul Carensac
</pre>
546 286 Paul Carensac
547 286 Paul Carensac
Project -> Properties -> Pydev interpreter -> Clic here to configure an interpreter not listed
548 286 Paul Carensac
549 286 Paul Carensac
select venv_py35_pyros
550 286 Paul Carensac
551 286 Paul Carensac
In Libraries, clic on 'New folder', then select your virtualenv's lib/python3.5/site-packages folder.
552 286 Paul Carensac
553 286 Paul Carensac
OK -> re-select venv_py35_pyros in 'Interpreter' dropdown menu
554 286 Paul Carensac
555 286 Paul Carensac
Then right clic on project -> Django/Custom command/runserver
556 270 Etienne Pallier
557 270 Etienne Pallier
check http://localhost:8000/
558 142 Etienne Pallier
559 142 Etienne Pallier
560 142 Etienne Pallier
---
561 142 Etienne Pallier
562 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)%
563 155 Paul Carensac
564 268 Etienne Pallier
[[django_backoffice_config|Configuration of the Django Back office (admin)]]
565 268 Etienne Pallier
566 211 Paul Carensac
567 229 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}V - INSTALLATION FROM THE BEGINNING (for dev only, history of the initial project creation)%
568 1 Etienne Pallier
569 236 Etienne Pallier
570 242 Etienne Pallier
[[pyros_install_from_start|Pyros installation from the beginning]]