Project Installation

Version 187 (Paul Carensac, 05/13/2016 03:26 pm)

1 1 Etienne Pallier
h1. Project Installation
2 1 Etienne Pallier
3 6 Etienne Pallier
4 11 Etienne Pallier
Project Development page : [[Project Development]]
5 11 Etienne Pallier
6 6 Etienne Pallier
HOWTO Format Redmine Wiki : http://www.redmine.org/projects/redmine/wiki/FrRedmineWikiFormatting
7 6 Etienne Pallier
8 6 Etienne Pallier
{{>toc}}
9 6 Etienne Pallier
10 6 Etienne Pallier
11 3 Etienne Pallier
---
12 3 Etienne Pallier
13 170 Etienne Pallier
---
14 170 Etienne Pallier
15 178 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}DATABASE SCHEMA (v0.2.1)%
16 4 Etienne Pallier
17 4 Etienne Pallier
18 4 Etienne Pallier
{{thumbnail(PYROS_PDM_v021.png, size=300, title=Pyros data model)}}
19 4 Etienne Pallier
20 4 Etienne Pallier
21 4 Etienne Pallier
---
22 5 Etienne Pallier
23 170 Etienne Pallier
---
24 170 Etienne Pallier
25 177 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}I - PREREQUISITES%
26 177 Etienne Pallier
27 181 Paul Carensac
Pyros needs some prerequisites : 
28 177 Etienne Pallier
29 1 Etienne Pallier
* Python 3
30 181 Paul Carensac
* RabbitMQ
31 177 Etienne Pallier
* (optional) a Mysql Database server (but you can use Sqlite instead, with no installation)
32 177 Etienne Pallier
33 177 Etienne Pallier
34 177 Etienne Pallier
---
35 177 Etienne Pallier
36 177 Etienne Pallier
h3. Install a database server (only if necessary)
37 177 Etienne Pallier
38 177 Etienne Pallier
_If the MySql database server is already installed on your computer, skip this section_
39 177 Etienne Pallier
40 177 Etienne Pallier
By default, Pyros uses Mysql, but this implies that you have to install the Mysql database server...
41 177 Etienne Pallier
42 177 Etienne Pallier
Thus, to make things easier, avoid Mysql installation by using Sqlite instead as the database server (which will need no installation at all) :
43 177 Etienne Pallier
44 177 Etienne Pallier
=> *For this, just edit the file PYROS/src/pyros/settings.py and set MYSQL variable to False, and that's it. You can go to next section*
45 177 Etienne Pallier
46 177 Etienne Pallier
Now, if you really want to use Mysql (which is the default), you will need to install it (only if not already installed), so keep reading.
47 177 Etienne Pallier
48 177 Etienne Pallier
_(Skip this if you are using Sqlite instead of MySql)_
49 177 Etienne Pallier
50 177 Etienne Pallier
 * Linux Ubuntu
51 177 Etienne Pallier
<pre>
52 177 Etienne Pallier
First, update your system:
53 177 Etienne Pallier
$ sudo apt-get update
54 177 Etienne Pallier
55 177 Etienne Pallier
$ sudo apt-get install mysql-server
56 177 Etienne Pallier
$ sudo apt-get install mysql-client
57 177 Etienne Pallier
58 177 Etienne Pallier
$ sudo apt-get install libmysqlclient-dev
59 177 Etienne Pallier
(needed for python package mysqlclient)
60 177 Etienne Pallier
</pre>
61 177 Etienne Pallier
62 177 Etienne Pallier
 * Linux CentOS : cf https://www.howtoforge.com/apache_php_mysql_on_centos_7_lamp#-installing-mysql-
63 177 Etienne Pallier
<pre>
64 177 Etienne Pallier
First, update your system:
65 177 Etienne Pallier
$ sudo yum update yum
66 177 Etienne Pallier
$ sudo yum update kernel
67 177 Etienne Pallier
$ sudo yum update
68 177 Etienne Pallier
69 177 Etienne Pallier
$ sudo yum install mariadb-server 
70 177 Etienne Pallier
$ sudo yum install mariadb
71 177 Etienne Pallier
72 177 Etienne Pallier
$ sudo yum install mariadb-devel
73 177 Etienne Pallier
(needed for python package mysqlclient)
74 177 Etienne Pallier
75 177 Etienne Pallier
$ sudo systemctl start mariadb.service
76 177 Etienne Pallier
77 177 Etienne Pallier
$ sudo systemctl enable mariadb.service
78 177 Etienne Pallier
=> Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
79 177 Etienne Pallier
80 177 Etienne Pallier
$ sudo mysql_secure_installation
81 177 Etienne Pallier
</pre>
82 177 Etienne Pallier
83 177 Etienne Pallier
 * Mac OS X
84 177 Etienne Pallier
Install XAMPP
85 177 Etienne Pallier
(but you could also use the pre-installed Mac OS MySql, or install MySql from macport)
86 177 Etienne Pallier
<pre>
87 177 Etienne Pallier
TODO:
88 177 Etienne Pallier
</pre>
89 177 Etienne Pallier
90 177 Etienne Pallier
 * Windows (tested with Windows 7)
91 177 Etienne Pallier
92 177 Etienne Pallier
<pre>
93 177 Etienne Pallier
Download and install the newest version on https://dev.mysql.com/downloads/installer/
94 177 Etienne Pallier
95 177 Etienne Pallier
Once installed, launch MySQL Installer. Clic on 'Add...' on the right.
96 177 Etienne Pallier
In MySQLServers section, choose the newest, then clic on next.
97 177 Etienne Pallier
Install and configure the server (just follow the installation guide).
98 177 Etienne Pallier
99 177 Etienne Pallier
Then launch mysql (via the Windows menu).
100 177 Etienne Pallier
</pre>
101 177 Etienne Pallier
102 177 Etienne Pallier
103 177 Etienne Pallier
---
104 177 Etienne Pallier
105 177 Etienne Pallier
h3. Install Python3 + pip + virtualenv (only if necessary)
106 177 Etienne Pallier
107 177 Etienne Pallier
_If Python 3 is already installed on your computer, skip this section_
108 177 Etienne Pallier
109 177 Etienne Pallier
110 177 Etienne Pallier
 * Linux (CentOS 7.1, main target): (python35 not yet available as rpm)
111 177 Etienne Pallier
<pre>
112 177 Etienne Pallier
$ sudo yum update yum
113 177 Etienne Pallier
$ sudo yum update kernel
114 177 Etienne Pallier
$ sudo yum update
115 177 Etienne Pallier
116 177 Etienne Pallier
$ sudo yum install python34
117 177 Etienne Pallier
$ python3.4 -V
118 177 Etienne Pallier
Python 3.4.3
119 177 Etienne Pallier
120 177 Etienne Pallier
$ sudo yum install python34-devel
121 177 Etienne Pallier
(needed for python package mysqlclient)
122 177 Etienne Pallier
123 177 Etienne Pallier
$ sudo yum update python-setuptools
124 177 Etienne Pallier
$ easy_install --version
125 177 Etienne Pallier
setuptools 0.9.8
126 177 Etienne Pallier
$ sudo easy_install pip
127 177 Etienne Pallier
$ pip --version
128 177 Etienne Pallier
pip 8.1.1 from /usr/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg (python 2.7)
129 177 Etienne Pallier
130 177 Etienne Pallier
131 177 Etienne Pallier
$ sudo pip install virtualenv
132 177 Etienne Pallier
$ virtualenv --version
133 177 Etienne Pallier
15.0.1
134 177 Etienne Pallier
</pre>
135 177 Etienne Pallier
136 177 Etienne Pallier
 * Linux (Ubuntu) :
137 177 Etienne Pallier
<pre>
138 177 Etienne Pallier
$ sudo add-apt-repository ppa:fkrull/deadsnakes
139 177 Etienne Pallier
$ sudo apt-get update
140 177 Etienne Pallier
$ sudo apt-get install python3.5
141 177 Etienne Pallier
142 177 Etienne Pallier
$ sudo apt-get install python3.5-dev
143 177 Etienne Pallier
(needed for python package mysqlclient)
144 177 Etienne Pallier
145 177 Etienne Pallier
$ sudo pip install virtualenv
146 177 Etienne Pallier
</pre>
147 177 Etienne Pallier
148 177 Etienne Pallier
149 177 Etienne Pallier
 * Mac OS X :
150 177 Etienne Pallier
151 177 Etienne Pallier
  * From binary (Mac OS native application)
152 177 Etienne Pallier
(TODO:)
153 177 Etienne Pallier
154 177 Etienne Pallier
  * From MacPort
155 177 Etienne Pallier
156 177 Etienne Pallier
   * a) install macport
157 177 Etienne Pallier
(TODO:)
158 177 Etienne Pallier
159 177 Etienne Pallier
   * b) install the "port" python35
160 177 Etienne Pallier
<pre>
161 177 Etienne Pallier
$ sudo port install python35
162 177 Etienne Pallier
</pre>
163 177 Etienne Pallier
164 177 Etienne Pallier
165 177 Etienne Pallier
 * Windows (tested with Windows 7) :
166 177 Etienne Pallier
(TODO: test with Windows 10)
167 177 Etienne Pallier
<pre>
168 177 Etienne Pallier
Go to https://www.python.org/downloads/windows/ , choose the wanted version
169 177 Etienne Pallier
On the wanted version’s page, download Windows x86 executable installer
170 177 Etienne Pallier
171 177 Etienne Pallier
Run the executable
172 177 Etienne Pallier
    * On the first page, check "Add python3.5 to PATH"
173 177 Etienne Pallier
    * Choose "Install now" option
174 177 Etienne Pallier
175 177 Etienne Pallier
Open cmd (windows + R, cmd) :
176 177 Etienne Pallier
 $ python -m pip install --upgrade pip
177 177 Etienne Pallier
 $ pip install virtualenv
178 177 Etienne Pallier
</pre>
179 177 Etienne Pallier
180 1 Etienne Pallier
---
181 181 Paul Carensac
182 181 Paul Carensac
h3. Install RabbitMQ
183 181 Paul Carensac
184 181 Paul Carensac
RabbitMQ is a message queue server used by Celery to handle tasks queues.
185 181 Paul Carensac
186 181 Paul Carensac
 * Ubuntu (the server is automatically started) :
187 181 Paul Carensac
<pre>
188 181 Paul Carensac
$ sudo apt-get install rabbitmq-server
189 181 Paul Carensac
</pre>
190 183 Paul Carensac
191 183 Paul Carensac
 * MacOS :
192 183 Paul Carensac
<pre>
193 183 Paul Carensac
TODO:
194 183 Paul Carensac
</pre>
195 183 Paul Carensac
196 183 Paul Carensac
 * Windows :
197 183 Paul Carensac
<pre>
198 183 Paul Carensac
TODO:
199 183 Paul Carensac
</pre>
200 177 Etienne Pallier
201 177 Etienne Pallier
---
202 177 Etienne Pallier
203 179 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}II - GET THE PYROS SOFTWARE%
204 5 Etienne Pallier
205 125 Etienne Pallier
h3. Authenticate to https://gitlab.irap.omp.eu/epallier/pyros
206 125 Etienne Pallier
207 125 Etienne Pallier
In order to get this software, you must first authenticate on the IRAP gitlab.
208 125 Etienne Pallier
209 125 Etienne Pallier
For this, just go to https://gitlab.irap.omp.eu/epallier/pyros
210 125 Etienne Pallier
and either sign in with your LDAP account (if you are from IRAP),
211 125 Etienne Pallier
or register via the "Sign up" form.
212 5 Etienne Pallier
213 113 Etienne Pallier
h3. Software structure
214 5 Etienne Pallier
215 156 Paul Carensac
Once you have fetched the project, you should obtain AT LEAST this structure:
216 5 Etienne Pallier
217 5 Etienne Pallier
<pre>
218 5 Etienne Pallier
219 5 Etienne Pallier
PYROS/
220 5 Etienne Pallier
├── install/
221 5 Etienne Pallier
│   └── REQUIREMENTS.txt
222 5 Etienne Pallier
│   └── INSTALLATION.txt
223 5 Etienne Pallier
├── public/
224 5 Etienne Pallier
│   └── static/
225 5 Etienne Pallier
├── src/
226 5 Etienne Pallier
│   ├── manage.py
227 5 Etienne Pallier
│   ├── pyros/
228 5 Etienne Pallier
│   │   ├── __init__.py
229 5 Etienne Pallier
│   │   ├── __pycache__
230 5 Etienne Pallier
│   │   ├── settings.py
231 5 Etienne Pallier
│   │   ├── urls.py
232 5 Etienne Pallier
│   │   └── wsgi.py
233 5 Etienne Pallier
│   └── pyrosapp/
234 5 Etienne Pallier
│       ├── __init__.py
235 5 Etienne Pallier
│       ├── admin.py
236 5 Etienne Pallier
│       ├── apps.py
237 5 Etienne Pallier
│       ├── migrations
238 5 Etienne Pallier
│       ├── models.py
239 5 Etienne Pallier
│       ├── tests.py
240 5 Etienne Pallier
│       └── views.py
241 5 Etienne Pallier
242 1 Etienne Pallier
243 1 Etienne Pallier
</pre>
244 1 Etienne Pallier
245 112 Etienne Pallier
h3. Browse the code (from gitlab)
246 111 Etienne Pallier
247 111 Etienne Pallier
https://gitlab.irap.omp.eu/epallier/pyros/tree/master
248 111 Etienne Pallier
249 113 Etienne Pallier
h3. Download it (static version, not synchronized)
250 111 Etienne Pallier
251 114 Etienne Pallier
You can download the current version of the software.
252 114 Etienne Pallier
253 115 Etienne Pallier
Go to https://gitlab.irap.omp.eu/epallier/pyros/tree/master
254 115 Etienne Pallier
255 115 Etienne Pallier
Click on "Download zip" on the up right hand corner.
256 115 Etienne Pallier
257 115 Etienne Pallier
Double-click on it to unzip it.
258 115 Etienne Pallier
259 115 Etienne Pallier
You should get a "pyros.git" folder.
260 115 Etienne Pallier
261 116 Etienne Pallier
In this documentation, this software folder will be referenced as "PYROS".
262 115 Etienne Pallier
263 118 Etienne Pallier
(you can rename "pyros.git" as "PYROS" if you want : "mv pyros.git PYROS")
264 114 Etienne Pallier
265 113 Etienne Pallier
h3. Get it from GIT (dynamic version, synchronized)
266 114 Etienne Pallier
267 122 Etienne Pallier
(If you are using Windows, you must first get the git software, see below "Get git for Windows")
268 122 Etienne Pallier
269 114 Etienne Pallier
By getting the software from git, you will get a dynamically synchronized version,
270 114 Etienne Pallier
which means that you will be able to update your version as soon as a new version is available
271 114 Etienne Pallier
(with the command : "git pull").
272 111 Etienne Pallier
273 111 Etienne Pallier
* From Eclipse : See below, section "NOTES FOR ECLIPSE USERS"
274 111 Etienne Pallier
275 111 Etienne Pallier
* From the terminal
276 5 Etienne Pallier
277 5 Etienne Pallier
<pre>
278 5 Etienne Pallier
git clone https://gitlab.irap.omp.eu/epallier/pyros.git PYROS
279 1 Etienne Pallier
</pre>
280 86 Etienne Pallier
281 86 Etienne Pallier
_(or also : git clone git@gitlab.irap.omp.eu:epallier/pyros.git PYROS)_
282 5 Etienne Pallier
283 126 Etienne Pallier
If you ever get this error message :
284 126 Etienne Pallier
<pre>
285 126 Etienne Pallier
fatal: unable to access 'https://gitlab.irap.omp.eu/epallier/pyros.git/': Peer's certificate issuer has been marked as not trusted by the user.
286 126 Etienne Pallier
</pre>
287 126 Etienne Pallier
288 126 Etienne Pallier
Then, type this command (and then run again the git clone command):
289 126 Etienne Pallier
<pre>
290 126 Etienne Pallier
$ git config --global http.sslVerify false
291 126 Etienne Pallier
</pre>
292 126 Etienne Pallier
293 126 Etienne Pallier
(Also, the first time you get the project, it will ask you for a login and password)
294 124 Etienne Pallier
295 5 Etienne Pallier
This creates a PYROS/ folder containing the project (with a .git/ subfolder for synchronization with the git repository)
296 1 Etienne Pallier
297 1 Etienne Pallier
298 122 Etienne Pallier
h4. (Windows only) : Get git for Windows
299 122 Etienne Pallier
300 122 Etienne Pallier
 * Download git at https://git-scm.com/download/win
301 121 Paul Carensac
 * Run setup (keep default configurations)
302 121 Paul Carensac
 * Once installed, open cmd
303 121 Paul Carensac
<pre>
304 121 Paul Carensac
$ git config --global http.sslVerify false
305 1 Etienne Pallier
</pre>
306 121 Paul Carensac
307 168 Etienne Pallier
You can now use your git from the cmd or the graphic client !
308 168 Etienne Pallier
309 168 Etienne Pallier
310 169 Etienne Pallier
311 169 Etienne Pallier
312 169 Etienne Pallier
---
313 169 Etienne Pallier
314 169 Etienne Pallier
---
315 169 Etienne Pallier
316 186 Paul Carensac
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}III - INSTALLATION OF NEEDED PROJECT DEPENDENCIES%
317 166 Etienne Pallier
318 186 Paul Carensac
Install the needed Project dependencies and the database (within a Python virtual environment)
319 98 Etienne Pallier
320 136 Etienne Pallier
Go into the PYROS/install/ folder and Run the install_requirements.sh script.
321 1 Etienne Pallier
322 136 Etienne Pallier
(You will be prompted to enter a username, an email, and a password for the superuser)
323 136 Etienne Pallier
324 1 Etienne Pallier
* Mac and Linux:
325 110 Paul Carensac
<pre>
326 110 Paul Carensac
./install_requirements.sh
327 1 Etienne Pallier
</pre>
328 107 Etienne Pallier
329 134 Etienne Pallier
* Windows:
330 135 Etienne Pallier
<pre>
331 134 Etienne Pallier
install_requirements_windows.bat
332 107 Etienne Pallier
</pre>
333 1 Etienne Pallier
334 1 Etienne Pallier
_If something goes wrong, install manually each package (see section "MANUAL INSTALLATION OF PYTHON PACKAGES, ONE BY ONE")_
335 186 Paul Carensac
336 186 Paul Carensac
---
337 186 Paul Carensac
338 186 Paul Carensac
h3. Install Comet
339 186 Paul Carensac
340 186 Paul Carensac
Comet is a broker to receive and send VOEvents (https://github.com/jdswinbank/Comet/tree/py3)
341 187 Paul Carensac
You MUST have your virtualenv activated (*source venv_py3_pyros/bin/activate* in your 'private/' directory)
342 186 Paul Carensac
Documentation is available here : http://comet.readthedocs.io/en/stable/installation.html
343 186 Paul Carensac
344 186 Paul Carensac
 * Ubuntu :
345 186 Paul Carensac
346 186 Paul Carensac
<pre>
347 186 Paul Carensac
# You can do this anywhere on your computer
348 186 Paul Carensac
$ git clone https://github.com/jdswinbank/Comet.git
349 186 Paul Carensac
$ cd Comet
350 186 Paul Carensac
$ (sudo ?) python setup.py install
351 186 Paul Carensac
352 186 Paul Carensac
# Now you can test it, no failure are expected, please contact the dev team for help
353 186 Paul Carensac
$ trial comet
354 186 Paul Carensac
</pre>
355 186 Paul Carensac
356 186 Paul Carensac
357 186 Paul Carensac
 * MacOS :
358 186 Paul Carensac
<pre>
359 186 Paul Carensac
TODO:
360 186 Paul Carensac
</pre>
361 186 Paul Carensac
362 186 Paul Carensac
 * Windows :
363 186 Paul Carensac
<pre>
364 186 Paul Carensac
TODO:
365 186 Paul Carensac
</pre>
366 186 Paul Carensac
367 98 Etienne Pallier
368 9 Etienne Pallier
---
369 9 Etienne Pallier
370 9 Etienne Pallier
h3. (Eclipse only) Set the Python3 virtual environment as the project interpreter
371 9 Etienne Pallier
372 65 Etienne Pallier
See below, in section "NOTES FOR ECLIPSE USERS"
373 9 Etienne Pallier
374 1 Etienne Pallier
---
375 1 Etienne Pallier
376 170 Etienne Pallier
---
377 170 Etienne Pallier
378 17 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}IV - TEST%
379 17 Etienne Pallier
380 108 Etienne Pallier
381 90 Etienne Pallier
(Tests are classes declared in all apps' test.py file. The test classes inherit from django.test.TestCase)
382 17 Etienne Pallier
383 17 Etienne Pallier
You can run the tests suite, just to be sure that the software is well installed.
384 17 Etienne Pallier
385 19 Etienne Pallier
h3. From Terminal
386 19 Etienne Pallier
387 19 Etienne Pallier
388 1 Etienne Pallier
<pre>
389 1 Etienne Pallier
390 94 Etienne Pallier
$ cd PYROS/
391 20 Etienne Pallier
392 159 Paul Carensac
$ ./pyrosrun test
393 94 Etienne Pallier
Ran 5 tests in 0.093s
394 21 Etienne Pallier
OK
395 17 Etienne Pallier
</pre>
396 19 Etienne Pallier
397 160 Paul Carensac
h3. From Eclipse
398 1 Etienne Pallier
399 77 Etienne Pallier
See below, in section "NOTES FOR ECLIPSE USERS"
400 25 Paul Carensac
401 25 Paul Carensac
402 160 Paul Carensac
h3. Custom commands
403 27 Paul Carensac
404 25 Paul Carensac
$ [./manage.py] test app.tests                           # Run tests for the application 'app'
405 25 Paul Carensac
$ [./manage.py] test app.tests.ModelTests                # Run test methods declared in the class app.tests.ModelTests
406 25 Paul Carensac
$ [./manage.py] test app.tests.ModelTests.test_method    # Only run the method test_method declared in app.tests.ModelTests
407 33 Etienne Pallier
408 33 Etienne Pallier
409 1 Etienne Pallier
---
410 1 Etienne Pallier
411 170 Etienne Pallier
---
412 170 Etienne Pallier
413 92 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}V - RUN%
414 75 Etienne Pallier
415 109 Etienne Pallier
416 75 Etienne Pallier
* From the terminal
417 75 Etienne Pallier
418 75 Etienne Pallier
<pre>
419 75 Etienne Pallier
420 95 Etienne Pallier
$ cd PYROS/
421 1 Etienne Pallier
422 158 Paul Carensac
$ ./pyrosrun server
423 93 Paul Carensac
</pre>
424 75 Etienne Pallier
425 158 Paul Carensac
Now, go to "http://localhost:8000/admin" in your browser
426 91 Etienne Pallier
427 158 Paul Carensac
(and login as "pyros" with the password 'DjangoPyros')
428 105 Etienne Pallier
429 91 Etienne Pallier
(Ctrl-c to stop)
430 91 Etienne Pallier
431 91 Etienne Pallier
432 75 Etienne Pallier
433 106 Etienne Pallier
* From Eclipse : see below, in section "NOTES FOR ECLIPSE USERS"
434 75 Etienne Pallier
435 75 Etienne Pallier
436 1 Etienne Pallier
---
437 1 Etienne Pallier
438 170 Etienne Pallier
---
439 170 Etienne Pallier
440 33 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}NOTES FOR ECLIPSE USERS%
441 35 Etienne Pallier
442 35 Etienne Pallier
0) Install Eclipse (if necessary)
443 35 Etienne Pallier
444 35 Etienne Pallier
Get the Eclipse version for Php
445 35 Etienne Pallier
446 35 Etienne Pallier
Install the plug-in pydev (via install new software, add http://pydev.org/updates)
447 35 Etienne Pallier
448 35 Etienne Pallier
Install the django template editor (via install new software, add http://eclipse.kacprzak.org/updates)
449 35 Etienne Pallier
450 35 Etienne Pallier
1) Deactivate CA certificate verification
451 35 Etienne Pallier
452 35 Etienne Pallier
Window -> Preferences -> Team -> git -> configuration -> Add entry
453 35 Etienne Pallier
454 35 Etienne Pallier
Key = http.sslVerify
455 35 Etienne Pallier
Value = false
456 35 Etienne Pallier
457 35 Etienne Pallier
2) Fetch the project
458 35 Etienne Pallier
459 35 Etienne Pallier
File/Import project from git
460 35 Etienne Pallier
461 35 Etienne Pallier
Select repository source: Clone URI: https://gitlab.irap.omp.eu/epallier/pyros.git
462 35 Etienne Pallier
463 35 Etienne Pallier
Directory: 
464 35 Etienne Pallier
par défaut, il propose : /Users/epallier/git/pyros
465 35 Etienne Pallier
mais on peut le mettre ailleurs (c'est ce que j'ai fait)
466 35 Etienne Pallier
467 35 Etienne Pallier
initial branch: master
468 35 Etienne Pallier
remote name: origin
469 35 Etienne Pallier
470 35 Etienne Pallier
Import as general project
471 35 Etienne Pallier
472 35 Etienne Pallier
Project name: PYROS
473 35 Etienne Pallier
474 35 Etienne Pallier
475 35 Etienne Pallier
3) Configure the project
476 35 Etienne Pallier
477 35 Etienne Pallier
The project is created. Now, you have to set it as a «PyDev » and a « Django » project.
478 35 Etienne Pallier
479 35 Etienne Pallier
clic droit sur le projet / PyDev / set as a PyDev project
480 35 Etienne Pallier
481 35 Etienne Pallier
clic droit sur le projet / PyDev / set as a Django project
482 35 Etienne Pallier
483 35 Etienne Pallier
clic droit sur le projet : on doit maintenant avoir un sous-menu Django
484 35 Etienne Pallier
485 35 Etienne Pallier
clic droit sur le dossier src / PyDev / set as source folder (add to PYTHONPATH)
486 35 Etienne Pallier
487 35 Etienne Pallier
clic droit sur projet / Properties / Pydev-Django :
488 35 Etienne Pallier
  - Django manage.py : src/manage.py
489 35 Etienne Pallier
  - Django settings module : pyros.settings
490 35 Etienne Pallier
491 35 Etienne Pallier
492 35 Etienne Pallier
4) Set Code style
493 35 Etienne Pallier
494 35 Etienne Pallier
Window/Preferences : Pydev / Editor
495 35 Etienne Pallier
- Auto Imports : uncheck « Do auto import »
496 35 Etienne Pallier
- Code style:
497 35 Etienne Pallier
	- Locals … : camelCase
498 35 Etienne Pallier
	- Methods : camelCase() with first lower
499 35 Etienne Pallier
- Code style / Code Formatter: activer « use autopep8.py for code formatting »
500 35 Etienne Pallier
- Tabs : Tab length : 4
501 35 Etienne Pallier
502 67 Etienne Pallier
5) Now, once the Python3 virtual environment is installed (see above),
503 66 Etienne Pallier
set it in Eclipse as the project interpreter:
504 66 Etienne Pallier
505 68 Etienne Pallier
Right clic on the project / Properties / PyDev - Interpreter/Grammar :
506 66 Etienne Pallier
Grammar version : 3
507 66 Etienne Pallier
508 66 Etienne Pallier
Interpreter : click on « click here to configure an interpreter not listed »
509 66 Etienne Pallier
510 66 Etienne Pallier
click on « New... » :
511 66 Etienne Pallier
- Interpreter name : venv_py35_pyros
512 66 Etienne Pallier
- Interpreter executable : click on « Browse »
513 66 Etienne Pallier
	Select your virtualenv python35 executable (private/venv_py35_pyros/bin/python3.5)
514 66 Etienne Pallier
	click OK
515 66 Etienne Pallier
516 66 Etienne Pallier
*Now, a last thing to do so that Pydev finds Django:*
517 66 Etienne Pallier
518 66 Etienne Pallier
In the Python interpreters list, select your virtual env (venv_py35_pyros)
519 66 Etienne Pallier
520 66 Etienne Pallier
Click on the tab "Libraries"
521 66 Etienne Pallier
522 66 Etienne Pallier
clic on 'New folder', then select your virtualenv's lib/python3.5/site-packages folder
523 66 Etienne Pallier
524 66 Etienne Pallier
OK
525 66 Etienne Pallier
526 66 Etienne Pallier
Interpreter: select now venv_py35_pyros from the list
527 66 Etienne Pallier
528 66 Etienne Pallier
OK
529 62 Etienne Pallier
530 78 Etienne Pallier
6) Test
531 1 Etienne Pallier
532 78 Etienne Pallier
* Right-clic on the project / Django / Run Django tests
533 78 Etienne Pallier
534 78 Etienne Pallier
* Right-clic on the project / Django / Custom command / ...
535 78 Etienne Pallier
536 78 Etienne Pallier
537 78 Etienne Pallier
7) Run
538 70 Etienne Pallier
539 70 Etienne Pallier
Right clic on project -> Django/Custom command/runserver
540 70 Etienne Pallier
541 70 Etienne Pallier
Error on Ubuntu :
542 70 Etienne Pallier
543 70 Etienne Pallier
<pre>
544 70 Etienne Pallier
545 70 Etienne Pallier
Traceback (most recent call last):
546 70 Etienne Pallier
  File "/home/carens_p/git/pyros/src/manage.py", line 8, in <module>
547 70 Etienne Pallier
    from django.core.management import execute_from_command_line
548 70 Etienne Pallier
ImportError: No module named 'django'
549 70 Etienne Pallier
550 70 Etienne Pallier
</pre>
551 70 Etienne Pallier
552 70 Etienne Pallier
Project -> Properties -> Pydev interpreter -> Clic here to configure an interpreter not listed
553 70 Etienne Pallier
554 70 Etienne Pallier
select venv_py35_pyros
555 70 Etienne Pallier
556 70 Etienne Pallier
In Libraries, clic on 'New folder', then select your virtualenv's lib/python3.5/site-packages folder.
557 70 Etienne Pallier
558 70 Etienne Pallier
OK -> re-select venv_py35_pyros in 'Interpreter' dropdown menu
559 70 Etienne Pallier
560 70 Etienne Pallier
Then right clic on project -> Django/Custom command/runserver
561 70 Etienne Pallier
562 70 Etienne Pallier
check http://localhost:8000/
563 70 Etienne Pallier
564 70 Etienne Pallier
565 62 Etienne Pallier
---
566 62 Etienne Pallier
567 62 Etienne Pallier
---
568 62 Etienne Pallier
569 81 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}MANUAL INSTALLATION OF PYTHON PACKAGES ONE BY ONE%
570 81 Etienne Pallier
571 172 Etienne Pallier
*Follow these steps only if the previous guided and nearly automatic installation did not work for you*
572 100 Etienne Pallier
573 172 Etienne Pallier
574 174 Etienne Pallier
h3. (Only if using Mysql) Create the database "pyros" and the pyros user
575 174 Etienne Pallier
576 174 Etienne Pallier
Only if you are using Mysql, you need to create an empty database "pyros"
577 174 Etienne Pallier
(which will be filled automatically by django)
578 174 Etienne Pallier
579 174 Etienne Pallier
<pre>
580 174 Etienne Pallier
$ mysql -u root -p
581 174 Etienne Pallier
(enter your root password)
582 174 Etienne Pallier
583 174 Etienne Pallier
$ mysql> create database if not exists pyros;
584 174 Etienne Pallier
</pre>
585 174 Etienne Pallier
586 174 Etienne Pallier
The user creation depends on your MySQL version :
587 174 Etienne Pallier
588 174 Etienne Pallier
 * 5.7 and above :
589 174 Etienne Pallier
<pre>
590 174 Etienne Pallier
$ mysql> DROP USER IF EXISTS pyros;
591 174 Etienne Pallier
$ mysql> CREATE USER 'pyros' IDENTIFIED BY 'DjangoPyros';
592 174 Etienne Pallier
$ mysql> GRANT ALL PRIVILEGES ON pyros.* TO pyros;
593 174 Etienne Pallier
</pre>
594 174 Etienne Pallier
595 174 Etienne Pallier
 * under 5.7 :
596 174 Etienne Pallier
<pre>
597 174 Etienne Pallier
$ mysql> GRANT USAGE ON *.* TO 'pyros';
598 174 Etienne Pallier
$ mysql> DROP USER 'pyros';
599 174 Etienne Pallier
$ mysql> CREATE USER 'pyros' IDENTIFIED BY 'DjangoPyros';
600 174 Etienne Pallier
$ mysql> GRANT ALL PRIVILEGES ON pyros.* TO pyros;
601 174 Etienne Pallier
</pre>
602 174 Etienne Pallier
603 174 Etienne Pallier
If none of these solution work, check on the internet to create a user named pyros with the password DjangoPyros.
604 174 Etienne Pallier
605 100 Etienne Pallier
h3. Create a Python3 virtual environment dedicated to the project (inside the project folder)
606 100 Etienne Pallier
607 100 Etienne Pallier
<pre>
608 100 Etienne Pallier
609 100 Etienne Pallier
$ mkdir private/
610 100 Etienne Pallier
611 100 Etienne Pallier
$ cd private/
612 100 Etienne Pallier
613 100 Etienne Pallier
$ which python3.5 ("where python" for windows)
614 100 Etienne Pallier
/opt/local/bin/python3.5
615 100 Etienne Pallier
616 100 Etienne Pallier
$ virtualenv venv_py35_pyros -p /opt/local/bin/python3.5
617 100 Etienne Pallier
=> creates a venv_py35_pyros/ folder inside PYROS/private/
618 100 Etienne Pallier
619 100 Etienne Pallier
</pre>
620 100 Etienne Pallier
621 100 Etienne Pallier
622 100 Etienne Pallier
---
623 100 Etienne Pallier
624 100 Etienne Pallier
h3. Activate the python virtual environment (from inside the project)
625 100 Etienne Pallier
626 100 Etienne Pallier
<pre>
627 100 Etienne Pallier
628 100 Etienne Pallier
$ pwd
629 100 Etienne Pallier
.../PYROS/private
630 100 Etienne Pallier
631 100 Etienne Pallier
$ source ./venv_py35_pyros/bin/activate (venv_py35_pyros/Scripts/activate on Windows)
632 100 Etienne Pallier
633 100 Etienne Pallier
</pre>
634 100 Etienne Pallier
635 100 Etienne Pallier
---
636 100 Etienne Pallier
637 100 Etienne Pallier
h3. Install needed python packages
638 100 Etienne Pallier
639 81 Etienne Pallier
Check that the virtual environment is activated
640 81 Etienne Pallier
<pre>
641 81 Etienne Pallier
$ python -V
642 81 Etienne Pallier
Python 3...
643 81 Etienne Pallier
644 81 Etienne Pallier
$ which pip
645 81 Etienne Pallier
.../PYROS/venv_py35_pyros/bin/pip
646 81 Etienne Pallier
</pre>
647 81 Etienne Pallier
648 81 Etienne Pallier
649 81 Etienne Pallier
Upgrade pip to last version available:
650 81 Etienne Pallier
<pre>
651 81 Etienne Pallier
$ pip install --upgrade pip
652 81 Etienne Pallier
Collecting pip
653 81 Etienne Pallier
  Downloading pip-8.1.1-py2.py3-none-any.whl (1.2MB)
654 81 Etienne Pallier
Installing collected packages: pip
655 81 Etienne Pallier
  Found existing installation: pip 7.1.2
656 81 Etienne Pallier
    Uninstalling pip-7.1.2:
657 81 Etienne Pallier
      Successfully uninstalled pip-7.1.2
658 81 Etienne Pallier
Successfully installed pip-8.1.1
659 81 Etienne Pallier
660 81 Etienne Pallier
Upgrade wheel to last version available:
661 81 Etienne Pallier
$ pip install --upgrade wheel
662 81 Etienne Pallier
Collecting wheel
663 81 Etienne Pallier
  Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
664 81 Etienne Pallier
Installing collected packages: wheel
665 81 Etienne Pallier
  Found existing installation: wheel 0.24.0
666 81 Etienne Pallier
    Uninstalling wheel-0.24.0:
667 81 Etienne Pallier
      Successfully uninstalled wheel-0.24.0
668 81 Etienne Pallier
Successfully installed wheel-0.29.0
669 81 Etienne Pallier
670 81 Etienne Pallier
</pre>
671 81 Etienne Pallier
672 81 Etienne Pallier
Go into the install/ folder:
673 81 Etienne Pallier
<pre>
674 81 Etienne Pallier
$ cd .../PYROS/install/
675 81 Etienne Pallier
</pre>
676 81 Etienne Pallier
677 84 Etienne Pallier
Install all the needed python packages at once:
678 85 Etienne Pallier
<pre>
679 1 Etienne Pallier
$ pip install -r REQUIREMENTS.txt
680 85 Etienne Pallier
</pre>
681 84 Etienne Pallier
682 84 Etienne Pallier
If something goes wrong, install them one by one:
683 62 Etienne Pallier
684 62 Etienne Pallier
  * *Install Django* :
685 62 Etienne Pallier
<pre>
686 62 Etienne Pallier
$ pip install django
687 62 Etienne Pallier
Collecting django
688 62 Etienne Pallier
  Downloading Django-1.9.4-py2.py3-none-any.whl (6.6MB)
689 62 Etienne Pallier
Installing collected packages: django
690 62 Etienne Pallier
Successfully installed django-1.9.4
691 62 Etienne Pallier
692 62 Etienne Pallier
$ pip install django-admin-tools
693 62 Etienne Pallier
Collecting django-admin-tools
694 62 Etienne Pallier
  Downloading django_admin_tools-0.7.2-py2.py3-none-any.whl (289kB)
695 62 Etienne Pallier
Installing collected packages: django-admin-tools
696 62 Etienne Pallier
Successfully installed django-admin-tools-0.7.2
697 62 Etienne Pallier
698 62 Etienne Pallier
$ pip install django-debug-toolbar
699 62 Etienne Pallier
Collecting django-debug-toolbar
700 62 Etienne Pallier
  Downloading django_debug_toolbar-1.4-py2.py3-none-any.whl (212kB)
701 62 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)
702 62 Etienne Pallier
Collecting sqlparse (from django-debug-toolbar)
703 62 Etienne Pallier
  Downloading sqlparse-0.1.19.tar.gz (58kB)
704 62 Etienne Pallier
Building wheels for collected packages: sqlparse
705 62 Etienne Pallier
  Running setup.py bdist_wheel for sqlparse ... done
706 62 Etienne Pallier
  Stored in directory: /Users/epallier/Library/Caches/pip/wheels/7b/d4/72/6011bb100dd5fc213164e4bbee13d4e03261dd54ce6a5de6b8
707 62 Etienne Pallier
Successfully built sqlparse
708 62 Etienne Pallier
Installing collected packages: sqlparse, django-debug-toolbar
709 62 Etienne Pallier
Successfully installed django-debug-toolbar-1.4 sqlparse-0.1.19
710 62 Etienne Pallier
711 62 Etienne Pallier
$ pip install django-extensions
712 62 Etienne Pallier
Collecting django-extensions
713 62 Etienne Pallier
  Downloading django_extensions-1.6.1-py2.py3-none-any.whl (202kB)
714 62 Etienne Pallier
Collecting six>=1.2 (from django-extensions)
715 62 Etienne Pallier
  Downloading six-1.10.0-py2.py3-none-any.whl
716 62 Etienne Pallier
Installing collected packages: six, django-extensions
717 62 Etienne Pallier
Successfully installed django-extensions-1.6.1 six-1.10.0
718 62 Etienne Pallier
719 62 Etienne Pallier
$ pip install django-suit
720 62 Etienne Pallier
Collecting django-suit
721 62 Etienne Pallier
  Downloading django-suit-0.2.18.tar.gz (587kB)
722 62 Etienne Pallier
Building wheels for collected packages: django-suit
723 62 Etienne Pallier
  Running setup.py bdist_wheel for django-suit ... done
724 62 Etienne Pallier
  Stored in directory: /Users/epallier/Library/Caches/pip/wheels/12/8b/9a/e02ab0ad9229881638aa040d47d77c8f562999533811927d41
725 62 Etienne Pallier
Successfully built django-suit
726 62 Etienne Pallier
Installing collected packages: django-suit
727 62 Etienne Pallier
Successfully installed django-suit-0.2.18
728 62 Etienne Pallier
729 62 Etienne Pallier
</pre>
730 62 Etienne Pallier
731 62 Etienne Pallier
  * *Install the django boostrap css package* :
732 62 Etienne Pallier
<pre>
733 62 Etienne Pallier
$ pip install django-bootstrap3
734 62 Etienne Pallier
</pre>
735 62 Etienne Pallier
(==> 'bootstrap3' is then to be added as an application in settings.py -> INSTALLED_APPS)
736 62 Etienne Pallier
737 62 Etienne Pallier
  * *Install the web application server gunicorn (will be used in production instead of the dev django web server)* :
738 62 Etienne Pallier
<pre>
739 62 Etienne Pallier
$ pip install gunicorn
740 62 Etienne Pallier
Collecting gunicorn
741 62 Etienne Pallier
  Downloading gunicorn-19.4.5-py2.py3-none-any.whl (112kB)
742 62 Etienne Pallier
Installing collected packages: gunicorn
743 62 Etienne Pallier
Successfully installed gunicorn-19.4.5
744 62 Etienne Pallier
</pre>
745 62 Etienne Pallier
746 62 Etienne Pallier
  * *Install the python mysql client* (not needed if you want to use sqlite):
747 62 Etienne Pallier
<pre>
748 62 Etienne Pallier
$ pip install mysqlclient
749 62 Etienne Pallier
...
750 62 Etienne Pallier
</pre>
751 62 Etienne Pallier
752 146 Etienne Pallier
   * => If issue under Mac OS X:
753 62 Etienne Pallier
<pre>
754 62 Etienne Pallier
$ pip install mysqlclient
755 62 Etienne Pallier
Collecting mysqlclient
756 62 Etienne Pallier
  Downloading mysqlclient-1.3.7.tar.gz (79kB)
757 62 Etienne Pallier
Building wheels for collected packages: mysqlclient
758 62 Etienne Pallier
  Running setup.py bdist_wheel for mysqlclient ... error
759 62 Etienne Pallier
760 62 Etienne Pallier
  ----------------------------------------
761 62 Etienne Pallier
  Failed building wheel for mysqlclient
762 62 Etienne Pallier
  Running setup.py clean for mysqlclient
763 62 Etienne Pallier
Failed to build mysqlclient
764 62 Etienne Pallier
Installing collected packages: mysqlclient
765 62 Etienne Pallier
  Running setup.py install for mysqlclient ... done
766 62 Etienne Pallier
Successfully installed mysqlclient-1.3.7
767 62 Etienne Pallier
768 62 Etienne Pallier
BOUH !!!
769 1 Etienne Pallier
770 152 Etienne Pallier
=> Need to upgrade wheel:
771 146 Etienne Pallier
772 62 Etienne Pallier
$ pip install --upgrade wheel
773 62 Etienne Pallier
Collecting wheel
774 62 Etienne Pallier
  Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
775 62 Etienne Pallier
Installing collected packages: wheel
776 62 Etienne Pallier
  Found existing installation: wheel 0.24.0
777 62 Etienne Pallier
    Uninstalling wheel-0.24.0:
778 62 Etienne Pallier
      Successfully uninstalled wheel-0.24.0
779 62 Etienne Pallier
Successfully installed wheel-0.29.0
780 62 Etienne Pallier
781 153 Etienne Pallier
YES !!!
782 1 Etienne Pallier
783 154 Etienne Pallier
Only if necessary, you can reinstall mysqlclient:
784 153 Etienne Pallier
$ pip uninstall mysqlclient
785 62 Etienne Pallier
$ pip install mysqlclient
786 62 Etienne Pallier
Collecting mysqlclient
787 62 Etienne Pallier
  Using cached mysqlclient-1.3.7.tar.gz
788 62 Etienne Pallier
Building wheels for collected packages: mysqlclient
789 62 Etienne Pallier
  Running setup.py bdist_wheel for mysqlclient ... done
790 62 Etienne Pallier
  Stored in directory: /Users/epallier/Library/Caches/pip/wheels/9b/06/50/d11418c26cf8f2156b13d4363b5afde8e7e75ebb8540d0228d
791 62 Etienne Pallier
Successfully built mysqlclient
792 62 Etienne Pallier
Installing collected packages: mysqlclient
793 62 Etienne Pallier
Successfully installed mysqlclient-1.3.7
794 62 Etienne Pallier
795 1 Etienne Pallier
</pre>
796 62 Etienne Pallier
797 146 Etienne Pallier
   * => If issue under Windows
798 62 Etienne Pallier
<pre>
799 62 Etienne Pallier
Same message as the issue for Mac.
800 146 Etienne Pallier
801 152 Etienne Pallier
=> Need to upgrade wheel:
802 62 Etienne Pallier
803 62 Etienne Pallier
Go to http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient to download the newest mysqlclient wheel
804 62 Etienne Pallier
805 62 Etienne Pallier
$ pip install path\to\mysqlclient\wheel
806 62 Etienne Pallier
807 154 Etienne Pallier
(No need to redo "pip install mysqlclient")
808 62 Etienne Pallier
</pre>
809 163 Paul Carensac
810 163 Paul Carensac
  * *Install the julian day converter* :
811 163 Paul Carensac
<pre>
812 163 Paul Carensac
$ pip install jdcal
813 163 Paul Carensac
</pre>
814 182 Paul Carensac
815 182 Paul Carensac
  * *Install Celery* :
816 182 Paul Carensac
<pre>
817 182 Paul Carensac
$ pip install celery
818 182 Paul Carensac
$ pip install django-celery
819 182 Paul Carensac
</pre>