Wiki
Version 251 (Etienne Pallier, 03/22/2016 06:47 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 | 121 | Etienne Pallier | h2. %{margin-left:0px; font-weight:bold; font-size:25px; display:block; color:red;}I - TODO% |
12 | 121 | Etienne Pallier | |
13 | 251 | Etienne Pallier | * Intégration dans Eclipse |
14 | 125 | Etienne Pallier | |
15 | 251 | Etienne Pallier | * Séparation des BD Django et Pyros |
16 | 126 | Etienne Pallier | |
17 | 174 | Etienne Pallier | * Intégration des modules Django déjà développés |
18 | 125 | Etienne Pallier | |
19 | 121 | Etienne Pallier | |
20 | 3 | Etienne Pallier | --- |
21 | 1 | Etienne Pallier | |
22 | 140 | Etienne Pallier | h2. %{margin-left:0px; font-weight:bold; font-size:25px; display:block; color:red;}I - DATABASE SCHEMA (v0.2.1)% |
23 | 116 | Etienne Pallier | |
24 | 116 | Etienne Pallier | |
25 | 117 | Etienne Pallier | {{thumbnail(PYROS_PDM_v021.png, size=300, title=Pyros data model)}} |
26 | 121 | Etienne Pallier | |
27 | 121 | Etienne Pallier | |
28 | 121 | Etienne Pallier | --- |
29 | 116 | Etienne Pallier | |
30 | 141 | Etienne Pallier | h2. %{margin-left:0px; font-weight:bold; font-size:25px; display:block; color:red;}II - Get the project (from gitlab)% |
31 | 141 | Etienne Pallier | |
32 | 169 | Etienne Pallier | h3. Get the project from the terminal |
33 | 1 | Etienne Pallier | |
34 | 1 | Etienne Pallier | <pre> |
35 | 1 | Etienne Pallier | git clone https://gitlab.irap.omp.eu/epallier/pyros.git PYROS |
36 | 169 | Etienne Pallier | |
37 | 174 | Etienne Pallier | (or also : git clone git@gitlab.irap.omp.eu:epallier/pyros.git) |
38 | 1 | Etienne Pallier | </pre> |
39 | 1 | Etienne Pallier | |
40 | 197 | Etienne Pallier | This creates a PYROS/ folder containing the project (with a .git/ subfolder for synchronization with the git repository) |
41 | 1 | Etienne Pallier | |
42 | 225 | Etienne Pallier | _If you just wanted a static copy of the project (without synchronization) just remove the .git/ folder:_ |
43 | 1 | Etienne Pallier | <pre> |
44 | 1 | Etienne Pallier | $ rm -r .git/ |
45 | 1 | Etienne Pallier | </pre> |
46 | 226 | Etienne Pallier | |
47 | 226 | Etienne Pallier | You should obtain this structure: |
48 | 226 | Etienne Pallier | |
49 | 226 | Etienne Pallier | <pre> |
50 | 226 | Etienne Pallier | |
51 | 226 | Etienne Pallier | PYROS/ |
52 | 226 | Etienne Pallier | ├── REQUIREMENTS.txt |
53 | 226 | Etienne Pallier | ├── private/ |
54 | 226 | Etienne Pallier | │ └── venv_py35_pyros/ |
55 | 226 | Etienne Pallier | ├── public/ |
56 | 226 | Etienne Pallier | │ └── static/ |
57 | 226 | Etienne Pallier | ├── src/ |
58 | 226 | Etienne Pallier | │ ├── manage.py |
59 | 226 | Etienne Pallier | │ ├── pyros/ |
60 | 226 | Etienne Pallier | │ │ ├── __init__.py |
61 | 226 | Etienne Pallier | │ │ ├── __pycache__ |
62 | 226 | Etienne Pallier | │ │ ├── settings.py |
63 | 226 | Etienne Pallier | │ │ ├── urls.py |
64 | 226 | Etienne Pallier | │ │ └── wsgi.py |
65 | 226 | Etienne Pallier | │ └── pyrosapp/ |
66 | 226 | Etienne Pallier | │ ├── __init__.py |
67 | 226 | Etienne Pallier | │ ├── admin.py |
68 | 226 | Etienne Pallier | │ ├── apps.py |
69 | 226 | Etienne Pallier | │ ├── migrations |
70 | 226 | Etienne Pallier | │ ├── models.py |
71 | 226 | Etienne Pallier | │ ├── tests.py |
72 | 226 | Etienne Pallier | │ └── views.py |
73 | 226 | Etienne Pallier | |
74 | 226 | Etienne Pallier | |
75 | 226 | Etienne Pallier | </pre> |
76 | 226 | Etienne Pallier | |
77 | 174 | Etienne Pallier | |
78 | 174 | Etienne Pallier | h3. Get the project from Eclipse |
79 | 169 | Etienne Pallier | |
80 | 197 | Etienne Pallier | <pre> |
81 | 169 | Etienne Pallier | TODO: |
82 | 197 | Etienne Pallier | </pre> |
83 | 169 | Etienne Pallier | |
84 | 141 | Etienne Pallier | h2. %{margin-left:0px; font-weight:bold; font-size:25px; display:block; color:red;}III - INSTALLATION% |
85 | 2 | Etienne Pallier | |
86 | 120 | Etienne Pallier | |
87 | 120 | Etienne Pallier | --- |
88 | 120 | Etienne Pallier | |
89 | 184 | Etienne Pallier | h3. Install MySql (only if necessary) |
90 | 2 | Etienne Pallier | |
91 | 49 | Etienne Pallier | * Linux Ubuntu |
92 | 49 | Etienne Pallier | <pre> |
93 | 107 | Paul Carensac | |
94 | 107 | Paul Carensac | $ sudo apt-get install mysql-server |
95 | 107 | Paul Carensac | $ sudo apt-get install mysql-client |
96 | 107 | Paul Carensac | |
97 | 49 | Etienne Pallier | </pre> |
98 | 49 | Etienne Pallier | |
99 | 49 | Etienne Pallier | * Linux CentOS |
100 | 49 | Etienne Pallier | <pre> |
101 | 49 | Etienne Pallier | TODO: |
102 | 49 | Etienne Pallier | $ sudo yum install mysql |
103 | 49 | Etienne Pallier | ... |
104 | 49 | Etienne Pallier | </pre> |
105 | 49 | Etienne Pallier | |
106 | 49 | Etienne Pallier | * Mac OS X |
107 | 1 | Etienne Pallier | Install XAMPP |
108 | 1 | Etienne Pallier | (but you could also use the pre-installed Mac OS MySql) |
109 | 177 | Etienne Pallier | <pre> |
110 | 177 | Etienne Pallier | TODO: |
111 | 49 | Etienne Pallier | </pre> |
112 | 1 | Etienne Pallier | |
113 | 49 | Etienne Pallier | * Windows |
114 | 243 | Paul Carensac | |
115 | 1 | Etienne Pallier | <pre> |
116 | 243 | Paul Carensac | Download and install the newest version on https://dev.mysql.com/downloads/installer/ |
117 | 243 | Paul Carensac | |
118 | 243 | Paul Carensac | Once installed, launch MySQL Installer. Clic on 'Add...' on the right. |
119 | 243 | Paul Carensac | In MySQLServers section, choose the newest, then clic on next. |
120 | 243 | Paul Carensac | Install and configure the server (just follow the installation guide). |
121 | 243 | Paul Carensac | |
122 | 243 | Paul Carensac | Then launch mysql (via the Windows menu). |
123 | 49 | Etienne Pallier | </pre> |
124 | 49 | Etienne Pallier | |
125 | 49 | Etienne Pallier | |
126 | 49 | Etienne Pallier | --- |
127 | 1 | Etienne Pallier | |
128 | 185 | Etienne Pallier | h3. Install Python3.5 (only if necessary) |
129 | 1 | Etienne Pallier | |
130 | 11 | Etienne Pallier | |
131 | 11 | Etienne Pallier | * Mac OS X : |
132 | 1 | Etienne Pallier | <pre> |
133 | 183 | Etienne Pallier | |
134 | 24 | Etienne Pallier | 1) Installer MacPort |
135 | 24 | Etienne Pallier | (TODO: doc) |
136 | 24 | Etienne Pallier | |
137 | 24 | Etienne Pallier | 2) Installer le "port" python35 |
138 | 1 | Etienne Pallier | $ sudo port install python35 |
139 | 183 | Etienne Pallier | |
140 | 1 | Etienne Pallier | </pre> |
141 | 1 | Etienne Pallier | |
142 | 1 | Etienne Pallier | * Linux (Ubuntu) : |
143 | 1 | Etienne Pallier | <pre> |
144 | 244 | Paul Carensac | $ sudo add-apt-repository ppa:fkrull/deadsnakes |
145 | 244 | Paul Carensac | $ sudo apt-get update |
146 | 244 | Paul Carensac | $ sudo apt-get install python3.5 |
147 | 1 | Etienne Pallier | |
148 | 244 | Paul Carensac | $ sudo pip install virtualenv |
149 | 1 | Etienne Pallier | </pre> |
150 | 1 | Etienne Pallier | |
151 | 244 | Paul Carensac | |
152 | 244 | Paul Carensac | * Windows 7 : |
153 | 244 | Paul Carensac | <pre> |
154 | 244 | Paul Carensac | Go to https://www.python.org/downloads/windows/ , choose the wanted version |
155 | 244 | Paul Carensac | On the wanted version’s page, download Windows x86 executable installer |
156 | 244 | Paul Carensac | |
157 | 244 | Paul Carensac | Run the executable |
158 | 244 | Paul Carensac | * On the first page, check "Add python3.5 to PATH" |
159 | 244 | Paul Carensac | * Choose "Install now" option |
160 | 245 | Paul Carensac | |
161 | 245 | Paul Carensac | Open cmd (windows + R, cmd) : |
162 | 245 | Paul Carensac | $ python -m pip install --upgrade pip |
163 | 245 | Paul Carensac | $ pip install virtualenv |
164 | 244 | Paul Carensac | </pre> |
165 | 1 | Etienne Pallier | |
166 | 183 | Etienne Pallier | * Windows 10 : |
167 | 183 | Etienne Pallier | <pre> |
168 | 187 | Etienne Pallier | TODO: |
169 | 183 | Etienne Pallier | </pre> |
170 | 3 | Etienne Pallier | |
171 | 4 | Etienne Pallier | --- |
172 | 5 | Etienne Pallier | |
173 | 192 | Etienne Pallier | h3. Create a Python3 virtual environment dedicated to the project (inside the project folder) |
174 | 127 | Etienne Pallier | |
175 | 131 | Etienne Pallier | <pre> |
176 | 1 | Etienne Pallier | |
177 | 193 | Etienne Pallier | $ mkdir private/ |
178 | 193 | Etienne Pallier | |
179 | 133 | Etienne Pallier | $ cd private/ |
180 | 3 | Etienne Pallier | |
181 | 246 | Paul Carensac | $ which python3.5 ("where python" for windows) |
182 | 3 | Etienne Pallier | /opt/local/bin/python3.5 |
183 | 15 | Etienne Pallier | |
184 | 127 | Etienne Pallier | $ virtualenv-3.5 venv_py35_pyros -p /opt/local/bin/python3.5 |
185 | 3 | Etienne Pallier | => creates a venv_py35_pyros/ folder inside PYROS/private/ |
186 | 1 | Etienne Pallier | |
187 | 131 | Etienne Pallier | </pre> |
188 | 1 | Etienne Pallier | |
189 | 7 | Etienne Pallier | --- |
190 | 3 | Etienne Pallier | |
191 | 65 | Etienne Pallier | h3. Activate the python virtual environment (from inside the project) |
192 | 7 | Etienne Pallier | |
193 | 55 | Etienne Pallier | <pre> |
194 | 1 | Etienne Pallier | |
195 | 65 | Etienne Pallier | $ pwd |
196 | 134 | Etienne Pallier | .../PYROS/private |
197 | 1 | Etienne Pallier | |
198 | 247 | Paul Carensac | $ source ./venv_py35_pyros/bin/activate (venv_py35_pyros/Scripts/activate on Windows) |
199 | 247 | Paul Carensac | |
200 | 65 | Etienne Pallier | |
201 | 3 | Etienne Pallier | $ python -V |
202 | 1 | Etienne Pallier | Python 3.5.1 |
203 | 3 | Etienne Pallier | |
204 | 3 | Etienne Pallier | $ which pip |
205 | 77 | Etienne Pallier | .../PYROS/venv_py35_pyros/bin/pip |
206 | 16 | Etienne Pallier | |
207 | 194 | Etienne Pallier | Upgrade pip to last version available: |
208 | 3 | Etienne Pallier | $ pip install --upgrade pip |
209 | 3 | Etienne Pallier | Collecting pip |
210 | 3 | Etienne Pallier | Downloading pip-8.1.1-py2.py3-none-any.whl (1.2MB) |
211 | 3 | Etienne Pallier | Installing collected packages: pip |
212 | 3 | Etienne Pallier | Found existing installation: pip 7.1.2 |
213 | 3 | Etienne Pallier | Uninstalling pip-7.1.2: |
214 | 3 | Etienne Pallier | Successfully uninstalled pip-7.1.2 |
215 | 1 | Etienne Pallier | Successfully installed pip-8.1.1 |
216 | 194 | Etienne Pallier | |
217 | 194 | Etienne Pallier | Upgrade wheel to last version available: |
218 | 194 | Etienne Pallier | $ pip install --upgrade wheel |
219 | 194 | Etienne Pallier | Collecting wheel |
220 | 194 | Etienne Pallier | Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB) |
221 | 194 | Etienne Pallier | Installing collected packages: wheel |
222 | 194 | Etienne Pallier | Found existing installation: wheel 0.24.0 |
223 | 194 | Etienne Pallier | Uninstalling wheel-0.24.0: |
224 | 194 | Etienne Pallier | Successfully uninstalled wheel-0.24.0 |
225 | 194 | Etienne Pallier | Successfully installed wheel-0.29.0 |
226 | 194 | Etienne Pallier | |
227 | 55 | Etienne Pallier | |
228 | 55 | Etienne Pallier | </pre> |
229 | 18 | Etienne Pallier | |
230 | 212 | Etienne Pallier | h3. Install the needed Python packages (from within the virtual environment) |
231 | 18 | Etienne Pallier | |
232 | 66 | Etienne Pallier | First, be sure that the virtual environment is activated: |
233 | 66 | Etienne Pallier | <pre> |
234 | 66 | Etienne Pallier | $ python -V |
235 | 66 | Etienne Pallier | Python 3.5.1 |
236 | 66 | Etienne Pallier | </pre> |
237 | 66 | Etienne Pallier | |
238 | 62 | Etienne Pallier | * *Automatic Installation of all packages* |
239 | 62 | Etienne Pallier | <pre> |
240 | 90 | Etienne Pallier | $ pip install -r REQUIREMENTS.txt |
241 | 62 | Etienne Pallier | </pre> |
242 | 62 | Etienne Pallier | |
243 | 93 | Etienne Pallier | * *Or, manual installation of each package* |
244 | 62 | Etienne Pallier | |
245 | 62 | Etienne Pallier | * *Install Django* : |
246 | 32 | Etienne Pallier | <pre> |
247 | 3 | Etienne Pallier | $ pip install django |
248 | 3 | Etienne Pallier | Collecting django |
249 | 3 | Etienne Pallier | Downloading Django-1.9.4-py2.py3-none-any.whl (6.6MB) |
250 | 3 | Etienne Pallier | Installing collected packages: django |
251 | 3 | Etienne Pallier | Successfully installed django-1.9.4 |
252 | 3 | Etienne Pallier | |
253 | 3 | Etienne Pallier | $ pip install django-admin-tools |
254 | 3 | Etienne Pallier | Collecting django-admin-tools |
255 | 3 | Etienne Pallier | Downloading django_admin_tools-0.7.2-py2.py3-none-any.whl (289kB) |
256 | 3 | Etienne Pallier | Installing collected packages: django-admin-tools |
257 | 3 | Etienne Pallier | Successfully installed django-admin-tools-0.7.2 |
258 | 3 | Etienne Pallier | |
259 | 21 | Etienne Pallier | $ pip install django-debug-toolbar |
260 | 21 | Etienne Pallier | Collecting django-debug-toolbar |
261 | 21 | Etienne Pallier | Downloading django_debug_toolbar-1.4-py2.py3-none-any.whl (212kB) |
262 | 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) |
263 | 21 | Etienne Pallier | Collecting sqlparse (from django-debug-toolbar) |
264 | 21 | Etienne Pallier | Downloading sqlparse-0.1.19.tar.gz (58kB) |
265 | 21 | Etienne Pallier | Building wheels for collected packages: sqlparse |
266 | 21 | Etienne Pallier | Running setup.py bdist_wheel for sqlparse ... done |
267 | 21 | Etienne Pallier | Stored in directory: /Users/epallier/Library/Caches/pip/wheels/7b/d4/72/6011bb100dd5fc213164e4bbee13d4e03261dd54ce6a5de6b8 |
268 | 21 | Etienne Pallier | Successfully built sqlparse |
269 | 21 | Etienne Pallier | Installing collected packages: sqlparse, django-debug-toolbar |
270 | 21 | Etienne Pallier | Successfully installed django-debug-toolbar-1.4 sqlparse-0.1.19 |
271 | 21 | Etienne Pallier | |
272 | 21 | Etienne Pallier | $ pip install django-extensions |
273 | 21 | Etienne Pallier | Collecting django-extensions |
274 | 21 | Etienne Pallier | Downloading django_extensions-1.6.1-py2.py3-none-any.whl (202kB) |
275 | 21 | Etienne Pallier | Collecting six>=1.2 (from django-extensions) |
276 | 21 | Etienne Pallier | Downloading six-1.10.0-py2.py3-none-any.whl |
277 | 21 | Etienne Pallier | Installing collected packages: six, django-extensions |
278 | 21 | Etienne Pallier | Successfully installed django-extensions-1.6.1 six-1.10.0 |
279 | 21 | Etienne Pallier | |
280 | 21 | Etienne Pallier | $ pip install django-suit |
281 | 21 | Etienne Pallier | Collecting django-suit |
282 | 21 | Etienne Pallier | Downloading django-suit-0.2.18.tar.gz (587kB) |
283 | 21 | Etienne Pallier | Building wheels for collected packages: django-suit |
284 | 1 | Etienne Pallier | Running setup.py bdist_wheel for django-suit ... done |
285 | 1 | Etienne Pallier | Stored in directory: /Users/epallier/Library/Caches/pip/wheels/12/8b/9a/e02ab0ad9229881638aa040d47d77c8f562999533811927d41 |
286 | 1 | Etienne Pallier | Successfully built django-suit |
287 | 1 | Etienne Pallier | Installing collected packages: django-suit |
288 | 1 | Etienne Pallier | Successfully installed django-suit-0.2.18 |
289 | 21 | Etienne Pallier | |
290 | 32 | Etienne Pallier | </pre> |
291 | 32 | Etienne Pallier | |
292 | 63 | Etienne Pallier | * *Install the web application server gunicorn (will be used in production instead of the dev django web server)* : |
293 | 32 | Etienne Pallier | <pre> |
294 | 25 | Etienne Pallier | $ pip install gunicorn |
295 | 25 | Etienne Pallier | Collecting gunicorn |
296 | 25 | Etienne Pallier | Downloading gunicorn-19.4.5-py2.py3-none-any.whl (112kB) |
297 | 21 | Etienne Pallier | Installing collected packages: gunicorn |
298 | 26 | Etienne Pallier | Successfully installed gunicorn-19.4.5 |
299 | 1 | Etienne Pallier | </pre> |
300 | 1 | Etienne Pallier | |
301 | 63 | Etienne Pallier | * *Install the python mysql client*: |
302 | 32 | Etienne Pallier | <pre> |
303 | 32 | Etienne Pallier | $ pip install mysqlclient |
304 | 72 | Etienne Pallier | ... |
305 | 72 | Etienne Pallier | </pre> |
306 | 33 | Etienne Pallier | |
307 | 73 | Etienne Pallier | * => Issue under Mac OS X: |
308 | 72 | Etienne Pallier | <pre> |
309 | 3 | Etienne Pallier | $ pip install mysqlclient |
310 | 3 | Etienne Pallier | Collecting mysqlclient |
311 | 1 | Etienne Pallier | Downloading mysqlclient-1.3.7.tar.gz (79kB) |
312 | 22 | Etienne Pallier | Building wheels for collected packages: mysqlclient |
313 | 3 | Etienne Pallier | Running setup.py bdist_wheel for mysqlclient ... error |
314 | 3 | Etienne Pallier | … |
315 | 1 | Etienne Pallier | ---------------------------------------- |
316 | 1 | Etienne Pallier | Failed building wheel for mysqlclient |
317 | 1 | Etienne Pallier | Running setup.py clean for mysqlclient |
318 | 1 | Etienne Pallier | Failed to build mysqlclient |
319 | 1 | Etienne Pallier | Installing collected packages: mysqlclient |
320 | 1 | Etienne Pallier | Running setup.py install for mysqlclient ... done |
321 | 1 | Etienne Pallier | Successfully installed mysqlclient-1.3.7 |
322 | 1 | Etienne Pallier | |
323 | 1 | Etienne Pallier | BOUH !!! |
324 | 1 | Etienne Pallier | |
325 | 1 | Etienne Pallier | $ pip install --upgrade wheel |
326 | 1 | Etienne Pallier | Collecting wheel |
327 | 1 | Etienne Pallier | Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB) |
328 | 1 | Etienne Pallier | Installing collected packages: wheel |
329 | 1 | Etienne Pallier | Found existing installation: wheel 0.24.0 |
330 | 1 | Etienne Pallier | Uninstalling wheel-0.24.0: |
331 | 1 | Etienne Pallier | Successfully uninstalled wheel-0.24.0 |
332 | 1 | Etienne Pallier | Successfully installed wheel-0.29.0 |
333 | 1 | Etienne Pallier | |
334 | 1 | Etienne Pallier | $ pip uninstall mysqlclient |
335 | 1 | Etienne Pallier | |
336 | 1 | Etienne Pallier | $ pip install mysqlclient |
337 | 1 | Etienne Pallier | Collecting mysqlclient |
338 | 1 | Etienne Pallier | Using cached mysqlclient-1.3.7.tar.gz |
339 | 1 | Etienne Pallier | Building wheels for collected packages: mysqlclient |
340 | 1 | Etienne Pallier | Running setup.py bdist_wheel for mysqlclient ... done |
341 | 1 | Etienne Pallier | Stored in directory: /Users/epallier/Library/Caches/pip/wheels/9b/06/50/d11418c26cf8f2156b13d4363b5afde8e7e75ebb8540d0228d |
342 | 1 | Etienne Pallier | Successfully built mysqlclient |
343 | 1 | Etienne Pallier | Installing collected packages: mysqlclient |
344 | 1 | Etienne Pallier | Successfully installed mysqlclient-1.3.7 |
345 | 1 | Etienne Pallier | |
346 | 1 | Etienne Pallier | YES !!! |
347 | 1 | Etienne Pallier | |
348 | 1 | Etienne Pallier | </pre> |
349 | 1 | Etienne Pallier | |
350 | 107 | Paul Carensac | * => Issues under Ubuntu: |
351 | 107 | Paul Carensac | <pre> |
352 | 107 | Paul Carensac | $ pip install mysqlclient |
353 | 107 | Paul Carensac | Collecting mysqlclient |
354 | 107 | Paul Carensac | Downloading mysqlclient-1.3.7.tar.gz (79kB) |
355 | 107 | Paul Carensac | 100% |████████████████████████████████| 81kB 1.5MB/s |
356 | 107 | Paul Carensac | Complete output from command python setup.py egg_info: |
357 | 107 | Paul Carensac | /bin/sh: 1: mysql_config: not found |
358 | 107 | Paul Carensac | Traceback (most recent call last): |
359 | 107 | Paul Carensac | File "<string>", line 1, in <module> |
360 | 107 | Paul Carensac | [...] |
361 | 107 | Paul Carensac | ---------------------------------------- |
362 | 107 | Paul Carensac | Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-q6j4inuz/mysqlclient/ |
363 | 1 | Etienne Pallier | |
364 | 108 | Paul Carensac | BOUH !!! |
365 | 108 | Paul Carensac | |
366 | 107 | Paul Carensac | $ sudo apt-get install libmysqlclient-dev |
367 | 108 | Paul Carensac | |
368 | 107 | Paul Carensac | $ pip install mysqlclient |
369 | 107 | Paul Carensac | Collecting mysqlclient |
370 | 107 | Paul Carensac | Using cached mysqlclient-1.3.7.tar.gz |
371 | 107 | Paul Carensac | Building wheels for collected packages: mysqlclient |
372 | 107 | Paul Carensac | Running setup.py bdist_wheel for mysqlclient ... error |
373 | 107 | Paul Carensac | … |
374 | 107 | Paul Carensac | _mysql.c:40:20: fatal error: Python.h: No such file or directory |
375 | 107 | Paul Carensac | #include "Python.h" |
376 | 107 | Paul Carensac | ^ |
377 | 107 | Paul Carensac | compilation terminated. |
378 | 107 | Paul Carensac | error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 |
379 | 107 | Paul Carensac | |
380 | 107 | Paul Carensac | ---------------------------------------- |
381 | 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/ |
382 | 107 | Paul Carensac | |
383 | 108 | Paul Carensac | BOUH !!! |
384 | 108 | Paul Carensac | |
385 | 107 | Paul Carensac | $ sudo apt-get install python3.5-dev |
386 | 108 | Paul Carensac | |
387 | 107 | Paul Carensac | $ pip install mysqlclient |
388 | 107 | Paul Carensac | |
389 | 107 | Paul Carensac | YES !!! |
390 | 107 | Paul Carensac | |
391 | 107 | Paul Carensac | </pre> |
392 | 12 | Etienne Pallier | |
393 | 250 | Paul Carensac | * => Issue under Windows |
394 | 250 | Paul Carensac | <pre> |
395 | 250 | Paul Carensac | Same message as the issue for Mac. |
396 | 250 | Paul Carensac | |
397 | 250 | Paul Carensac | Go to http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient to download the newest mysqlclient wheel |
398 | 250 | Paul Carensac | |
399 | 250 | Paul Carensac | $ pip install path\to\mysqlclient\wheel |
400 | 250 | Paul Carensac | |
401 | 250 | Paul Carensac | No need to redo "pip install mysqlclient" |
402 | 250 | Paul Carensac | </pre> |
403 | 250 | Paul Carensac | |
404 | 12 | Etienne Pallier | --- |
405 | 28 | Etienne Pallier | |
406 | 142 | Etienne Pallier | h3. Test the project |
407 | 142 | Etienne Pallier | |
408 | 142 | Etienne Pallier | <pre> |
409 | 142 | Etienne Pallier | |
410 | 150 | Etienne Pallier | $ cd src/ |
411 | 150 | Etienne Pallier | |
412 | 1 | Etienne Pallier | $ ./manage.py runserver |
413 | 38 | Etienne Pallier | (or gunicorn pyros.wsgi) |
414 | 3 | Etienne Pallier | ==> http://localhost:8000 |
415 | 87 | Etienne Pallier | ... |
416 | 87 | Etienne Pallier | ... |
417 | 87 | Etienne Pallier | Ctrl-c |
418 | 87 | Etienne Pallier | |
419 | 1 | Etienne Pallier | </pre> |
420 | 142 | Etienne Pallier | |
421 | 142 | Etienne Pallier | |
422 | 142 | Etienne Pallier | |
423 | 142 | Etienne Pallier | --- |
424 | 142 | Etienne Pallier | |
425 | 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)% |
426 | 155 | Paul Carensac | |
427 | 155 | Paul Carensac | --- |
428 | 155 | Paul Carensac | |
429 | 155 | Paul Carensac | h3. Back Office setup |
430 | 155 | Paul Carensac | |
431 | 155 | Paul Carensac | * Prerequisites in src/pyros/settings.py : |
432 | 155 | Paul Carensac | |
433 | 155 | Paul Carensac | * INSTALLED_APPS must (at least) contain : |
434 | 155 | Paul Carensac | |
435 | 155 | Paul Carensac | * django.contrib.admin |
436 | 155 | Paul Carensac | * django.contrib.auth |
437 | 155 | Paul Carensac | * django.contrib.contenttypes |
438 | 155 | Paul Carensac | * django.contrib.sessions |
439 | 155 | Paul Carensac | |
440 | 155 | Paul Carensac | * MIDDLEWARES must (at least) contain : |
441 | 155 | Paul Carensac | |
442 | 155 | Paul Carensac | * django.contrib.sessions.middleware.SessionMiddleware |
443 | 155 | Paul Carensac | * django.middleware.common.CommonMiddleware |
444 | 155 | Paul Carensac | * django.contrib.auth.middleware.AuthenticationMiddleware |
445 | 155 | Paul Carensac | |
446 | 155 | Paul Carensac | * At least one 'python manage.py migrate' must have been executed |
447 | 155 | Paul Carensac | |
448 | 155 | Paul Carensac | * Create a superuser for the administration : |
449 | 155 | Paul Carensac | |
450 | 155 | Paul Carensac | <pre> |
451 | 155 | Paul Carensac | $ python manage.py createsuperuser |
452 | 155 | Paul Carensac | </pre> |
453 | 155 | Paul Carensac | |
454 | 156 | Paul Carensac | * For each app of the project, fill the admin.py file : |
455 | 155 | Paul Carensac | |
456 | 155 | Paul Carensac | <pre> |
457 | 155 | Paul Carensac | from django.contrib import admin |
458 | 155 | Paul Carensac | from app.models import Model1, Model2 |
459 | 155 | Paul Carensac | |
460 | 155 | Paul Carensac | admin.site.register(Model1) |
461 | 155 | Paul Carensac | admin.site.register(Model2) |
462 | 155 | Paul Carensac | </pre> |
463 | 155 | Paul Carensac | |
464 | 155 | Paul Carensac | *Reminder* : each application must be registered in the settings.py INSTALLED_APPS variable. |
465 | 157 | Paul Carensac | |
466 | 168 | Paul Carensac | * For each model in models.py, add a '__str__()' method in order to identify the object on the back office. Example : |
467 | 157 | Paul Carensac | |
468 | 157 | Paul Carensac | <pre> |
469 | 157 | Paul Carensac | class UserLevel(models.Model): |
470 | 157 | Paul Carensac | name = models.CharField(max_length=45, blank=True, null=True) |
471 | 157 | Paul Carensac | desc = models.TextField(blank=True, null=True) |
472 | 157 | Paul Carensac | priority = models.IntegerField(blank=True, null=True) |
473 | 157 | Paul Carensac | quota = models.FloatField(blank=True, null=True) |
474 | 157 | Paul Carensac | |
475 | 157 | Paul Carensac | class Meta: |
476 | 157 | Paul Carensac | managed = True |
477 | 157 | Paul Carensac | db_table = 'userlevel' |
478 | 157 | Paul Carensac | |
479 | 157 | Paul Carensac | def __str__(self): |
480 | 163 | Paul Carensac | return (str(self.name)) |
481 | 157 | Paul Carensac | </pre> |
482 | 157 | Paul Carensac | |
483 | 159 | Paul Carensac | *Naming convention* : Use self.name when possible, the creation time/date otherwise. Example : |
484 | 159 | Paul Carensac | |
485 | 159 | Paul Carensac | <pre> |
486 | 159 | Paul Carensac | class SiteWatch(models.Model): |
487 | 159 | Paul Carensac | updated = models.DateTimeField(blank=True, null=True) |
488 | 159 | Paul Carensac | lights = models.CharField(max_length=45, blank=True, null=True) |
489 | 159 | Paul Carensac | dome = models.CharField(max_length=45, blank=True, null=True) |
490 | 159 | Paul Carensac | doors = models.CharField(max_length=45, blank=True, null=True) |
491 | 159 | Paul Carensac | temperature = models.FloatField(blank=True, null=True) |
492 | 159 | Paul Carensac | |
493 | 159 | Paul Carensac | class Meta: |
494 | 159 | Paul Carensac | managed = True |
495 | 159 | Paul Carensac | db_table = 'sitewatch' |
496 | 159 | Paul Carensac | |
497 | 159 | Paul Carensac | def __str__(self): |
498 | 160 | Paul Carensac | return (str(self.updated)) |
499 | 159 | Paul Carensac | </pre> |
500 | 173 | Etienne Pallier | |
501 | 211 | Paul Carensac | --- |
502 | 211 | Paul Carensac | |
503 | 211 | Paul Carensac | h3. Adaptation of the one-to-many and many-to-many display |
504 | 211 | Paul Carensac | |
505 | 211 | Paul Carensac | * The one-to-many relationships are the following (One.many format) : |
506 | 211 | Paul Carensac | |
507 | 211 | Paul Carensac | * Schedule.sequences |
508 | 211 | Paul Carensac | * Request.sequences |
509 | 211 | Paul Carensac | * Sequence.albums |
510 | 211 | Paul Carensac | * Album.plans |
511 | 211 | Paul Carensac | * Plan.images |
512 | 211 | Paul Carensac | * Telescope.detectors |
513 | 211 | Paul Carensac | * Detector.filters |
514 | 211 | Paul Carensac | * NrtAnalysis.images |
515 | 211 | Paul Carensac | * Filter.plans |
516 | 211 | Paul Carensac | * Detector.albums |
517 | 211 | Paul Carensac | * UserLevel.users |
518 | 211 | Paul Carensac | * Country.users |
519 | 211 | Paul Carensac | * ScientificProgram.requests |
520 | 211 | Paul Carensac | * User.requests |
521 | 211 | Paul Carensac | * StrategyObs.alerts |
522 | 211 | Paul Carensac | * SequenceType.sequences |
523 | 211 | Paul Carensac | |
524 | 211 | Paul Carensac | * For each "many", create a new class in admin.py just after the imports, following these examples : |
525 | 211 | Paul Carensac | |
526 | 211 | Paul Carensac | <pre> |
527 | 211 | Paul Carensac | |
528 | 211 | Paul Carensac | For Schedule.sequences, Request.sequences and Sequentype.sequences, we will need : |
529 | 211 | Paul Carensac | |
530 | 211 | Paul Carensac | class SequenceInline(admin.TabularInline): |
531 | 211 | Paul Carensac | model = Sequence |
532 | 211 | Paul Carensac | fields = ("name",) |
533 | 211 | Paul Carensac | show_change_link = True |
534 | 211 | Paul Carensac | |
535 | 211 | Paul Carensac | |
536 | 211 | Paul Carensac | For Sequence.albums and Detector.albums, we will need : |
537 | 211 | Paul Carensac | |
538 | 211 | Paul Carensac | class AlbumInline(admin.TabularInline): |
539 | 211 | Paul Carensac | model = Album |
540 | 211 | Paul Carensac | fields = ("name",) |
541 | 211 | Paul Carensac | show_change_link = True |
542 | 211 | Paul Carensac | |
543 | 211 | Paul Carensac | |
544 | 211 | Paul Carensac | For StrategyObs.alerts, we will need : |
545 | 211 | Paul Carensac | |
546 | 211 | Paul Carensac | class AlertInline(admin.TabularInline): |
547 | 211 | Paul Carensac | model = Alert |
548 | 211 | Paul Carensac | fields = ("request.name",) # there is no 'name' attribute in the Alert model |
549 | 211 | Paul Carensac | show_change_link = True |
550 | 211 | Paul Carensac | |
551 | 211 | Paul Carensac | </pre> |
552 | 211 | Paul Carensac | |
553 | 222 | Paul Carensac | * For each "One", declare a new class in admin.py, just after the "Inlines" class declaration, as done in the following examples : |
554 | 211 | Paul Carensac | |
555 | 222 | Paul Carensac | <pre> |
556 | 222 | Paul Carensac | For Request.sequences : |
557 | 222 | Paul Carensac | |
558 | 222 | Paul Carensac | class RequestAdmin(admin.ModelAdmin): |
559 | 222 | Paul Carensac | inlines = [ |
560 | 222 | Paul Carensac | SequenceInline, |
561 | 222 | Paul Carensac | ] |
562 | 222 | Paul Carensac | |
563 | 222 | Paul Carensac | For Detector.filters and Detector.albums : |
564 | 222 | Paul Carensac | |
565 | 222 | Paul Carensac | class DetectorAdmin(admin.ModelAdmin): |
566 | 222 | Paul Carensac | inlines = [ |
567 | 222 | Paul Carensac | FilterInline, |
568 | 222 | Paul Carensac | AlbumInline, |
569 | 222 | Paul Carensac | ] |
570 | 222 | Paul Carensac | |
571 | 222 | Paul Carensac | </pre> |
572 | 222 | Paul Carensac | |
573 | 232 | Paul Carensac | |
574 | 222 | Paul Carensac | * The many-to-many relationships are the following : |
575 | 232 | Paul Carensac | |
576 | 222 | Paul Carensac | * ScientificProgram - User |
577 | 222 | Paul Carensac | * ScheduleHistory - Sequence |
578 | 222 | Paul Carensac | |
579 | 222 | Paul Carensac | * For each many-to-many relationship, declare a new "Inline" class in admin.py just after the imports, like this : |
580 | 222 | Paul Carensac | |
581 | 222 | Paul Carensac | <pre> |
582 | 222 | Paul Carensac | For ScientificProgram - User : |
583 | 222 | Paul Carensac | |
584 | 222 | Paul Carensac | class UserAndSPInline(admin.TabularInline): |
585 | 222 | Paul Carensac | model = ScientificProgram.users.through |
586 | 222 | Paul Carensac | |
587 | 222 | Paul Carensac | |
588 | 222 | Paul Carensac | For ScheduleHistory - Sequence |
589 | 222 | Paul Carensac | |
590 | 222 | Paul Carensac | class SequenceAndSHInline(admin.TabularInline): |
591 | 222 | Paul Carensac | model = ScheduleHistory.sequences.through |
592 | 222 | Paul Carensac | |
593 | 222 | Paul Carensac | </pre> |
594 | 222 | Paul Carensac | |
595 | 222 | Paul Carensac | +Note :+ The order in the line "model = ScientificProgram.users.through" is very important : the first model (ScientificProgram) is the one in which is declared the ManyToManyField relationship. |
596 | 232 | Paul Carensac | |
597 | 232 | Paul Carensac | * For each many-to-many relationship, declare two new classes in admin.py, just after the inlines, like in the following examples : |
598 | 232 | Paul Carensac | |
599 | 232 | Paul Carensac | <pre> |
600 | 232 | Paul Carensac | For the ScheduleHistory - Sequence relationship : |
601 | 232 | Paul Carensac | |
602 | 232 | Paul Carensac | class ScheduleHistoryAdmin(admin.ModelAdmin): |
603 | 232 | Paul Carensac | inlines = [ |
604 | 232 | Paul Carensac | SequenceAndSHInline, |
605 | 232 | Paul Carensac | ] |
606 | 232 | Paul Carensac | exclude = ('sequences',) # ScheduleHistory declares the ManyToManyField, and we want to replace its display in the back office, so we won't display the default field |
607 | 232 | Paul Carensac | |
608 | 232 | Paul Carensac | class SequenceAdmin(admin.ModelAdmin): |
609 | 232 | Paul Carensac | inlines = [ |
610 | 232 | Paul Carensac | AlbumInline, # This is the Inline for the one-to-many relationship Sequence.albums |
611 | 232 | Paul Carensac | SequenceAndSHInline, |
612 | 232 | Paul Carensac | ] |
613 | 232 | Paul Carensac | |
614 | 232 | Paul Carensac | For the ScientificProgram - User relationship : |
615 | 232 | Paul Carensac | |
616 | 232 | Paul Carensac | class ScientificProgramAdmin(admin.ModelAdmin): |
617 | 232 | Paul Carensac | inlines = [ |
618 | 232 | Paul Carensac | RequestInline, |
619 | 232 | Paul Carensac | UserAndSPInline, |
620 | 232 | Paul Carensac | ] |
621 | 232 | Paul Carensac | exclude = ('users',) # Same as ScheduleHistory |
622 | 232 | Paul Carensac | |
623 | 232 | Paul Carensac | class UserAdmin(admin.ModelAdmin): |
624 | 232 | Paul Carensac | inlines = [ |
625 | 232 | Paul Carensac | RequestInline, # This is the Inline for the one-to-many relationship User.requests |
626 | 232 | Paul Carensac | UserAndSPInline, |
627 | 232 | Paul Carensac | ] |
628 | 232 | Paul Carensac | |
629 | 232 | Paul Carensac | </pre> |
630 | 232 | Paul Carensac | |
631 | 235 | Paul Carensac | * For each ModelAdmin class in the admin.py, change the registering line |
632 | 235 | Paul Carensac | |
633 | 235 | Paul Carensac | <pre> |
634 | 235 | Paul Carensac | admin.site.register(Album) |
635 | 235 | Paul Carensac | </pre> |
636 | 235 | Paul Carensac | |
637 | 235 | Paul Carensac | to |
638 | 235 | Paul Carensac | |
639 | 235 | Paul Carensac | <pre> |
640 | 235 | Paul Carensac | admin.site.register(Album, AlbumAdmin) |
641 | 235 | Paul Carensac | </pre> |
642 | 211 | Paul Carensac | |
643 | 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)% |
644 | 1 | Etienne Pallier | |
645 | 236 | Etienne Pallier | |
646 | 242 | Etienne Pallier | [[pyros_install_from_start|Pyros installation from the beginning]] |