Wiki

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