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