Wiki
Version 65 (Etienne Pallier, 03/18/2016 12:22 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 | 1 | Etienne Pallier | |
10 | 3 | Etienne Pallier | --- |
11 | 1 | Etienne Pallier | |
12 | 57 | Etienne Pallier | h2. %{margin-left:0px; font-weight:bold; font-size:25px; display:block; color:red;}TODO% |
13 | 57 | Etienne Pallier | |
14 | 58 | Etienne Pallier | ajouter lien vers pyros.sql |
15 | 57 | Etienne Pallier | |
16 | 57 | Etienne Pallier | --- |
17 | 57 | Etienne Pallier | |
18 | 17 | Etienne Pallier | h2. %{margin-left:0px; font-weight:bold; font-size:25px; display:block; color:red;}I - INSTALLATION% |
19 | 2 | Etienne Pallier | |
20 | 51 | Etienne Pallier | h3. If necessary, install MySql |
21 | 2 | Etienne Pallier | |
22 | 49 | Etienne Pallier | * Linux Ubuntu |
23 | 49 | Etienne Pallier | <pre> |
24 | 49 | Etienne Pallier | TODO: |
25 | 49 | Etienne Pallier | $ sudo apt-get install mysql |
26 | 49 | Etienne Pallier | ... |
27 | 49 | Etienne Pallier | </pre> |
28 | 49 | Etienne Pallier | |
29 | 49 | Etienne Pallier | * Linux CentOS |
30 | 49 | Etienne Pallier | <pre> |
31 | 49 | Etienne Pallier | TODO: |
32 | 49 | Etienne Pallier | $ sudo yum install mysql |
33 | 49 | Etienne Pallier | ... |
34 | 49 | Etienne Pallier | </pre> |
35 | 49 | Etienne Pallier | |
36 | 49 | Etienne Pallier | * Mac OS X |
37 | 49 | Etienne Pallier | <pre> |
38 | 49 | Etienne Pallier | TODO: |
39 | 49 | Etienne Pallier | Install XAMPP |
40 | 49 | Etienne Pallier | (but you could also use the pre-installed Mac OS MySql) |
41 | 49 | Etienne Pallier | </pre> |
42 | 49 | Etienne Pallier | |
43 | 49 | Etienne Pallier | * Windows |
44 | 49 | Etienne Pallier | <pre> |
45 | 49 | Etienne Pallier | TODO: |
46 | 49 | Etienne Pallier | </pre> |
47 | 49 | Etienne Pallier | |
48 | 49 | Etienne Pallier | |
49 | 49 | Etienne Pallier | --- |
50 | 1 | Etienne Pallier | |
51 | 6 | Etienne Pallier | h3. Create database |
52 | 1 | Etienne Pallier | |
53 | 52 | Etienne Pallier | |
54 | 52 | Etienne Pallier | * Linux and Mac OS X: |
55 | 52 | Etienne Pallier | <pre> |
56 | 3 | Etienne Pallier | One liner: |
57 | 3 | Etienne Pallier | $ mysql -u root < pyros.sql |
58 | 1 | Etienne Pallier | |
59 | 3 | Etienne Pallier | Or : |
60 | 3 | Etienne Pallier | $ mysql -u root |
61 | 3 | Etienne Pallier | mysql> create database pyros; |
62 | 3 | Etienne Pallier | mysql> use pyros; |
63 | 3 | Etienne Pallier | mysql> source pyros.sql; |
64 | 1 | Etienne Pallier | |
65 | 3 | Etienne Pallier | ( |
66 | 3 | Etienne Pallier | TODO: |
67 | 3 | Etienne Pallier | mysql> grant all on pyros.* to pyros@localhost identified by ‘pyros’;) |
68 | 3 | Etienne Pallier | mysql> flush privileges; |
69 | 3 | Etienne Pallier | ) |
70 | 52 | Etienne Pallier | </pre> |
71 | 1 | Etienne Pallier | |
72 | 53 | Etienne Pallier | |
73 | 53 | Etienne Pallier | * Windows: |
74 | 52 | Etienne Pallier | <pre> |
75 | 52 | Etienne Pallier | TODO: Use phpmyadmin ? |
76 | 52 | Etienne Pallier | </pre> |
77 | 1 | Etienne Pallier | |
78 | 1 | Etienne Pallier | |
79 | 4 | Etienne Pallier | --- |
80 | 5 | Etienne Pallier | |
81 | 6 | Etienne Pallier | h3. Install python3.5 |
82 | 1 | Etienne Pallier | |
83 | 11 | Etienne Pallier | |
84 | 11 | Etienne Pallier | * Mac OS X : |
85 | 23 | Etienne Pallier | <pre> |
86 | 24 | Etienne Pallier | 1) Installer MacPort |
87 | 24 | Etienne Pallier | (TODO: doc) |
88 | 24 | Etienne Pallier | |
89 | 24 | Etienne Pallier | 2) Installer le "port" python35 |
90 | 1 | Etienne Pallier | $ sudo port install python35 |
91 | 23 | Etienne Pallier | </pre> |
92 | 1 | Etienne Pallier | |
93 | 11 | Etienne Pallier | * Linux (Ubuntu) : |
94 | 23 | Etienne Pallier | <pre> |
95 | 1 | Etienne Pallier | $ sudo apt-get ... |
96 | 23 | Etienne Pallier | </pre> |
97 | 1 | Etienne Pallier | |
98 | 5 | Etienne Pallier | |
99 | 3 | Etienne Pallier | |
100 | 4 | Etienne Pallier | --- |
101 | 5 | Etienne Pallier | |
102 | 13 | Etienne Pallier | h3. Create project dir |
103 | 13 | Etienne Pallier | |
104 | 13 | Etienne Pallier | $ mkdir pyros |
105 | 13 | Etienne Pallier | |
106 | 13 | Etienne Pallier | |
107 | 13 | Etienne Pallier | --- |
108 | 13 | Etienne Pallier | |
109 | 59 | Etienne Pallier | |
110 | 59 | Etienne Pallier | h3. Get the project (from git) |
111 | 59 | Etienne Pallier | |
112 | 59 | Etienne Pallier | TODO: |
113 | 59 | Etienne Pallier | |
114 | 59 | Etienne Pallier | |
115 | 59 | Etienne Pallier | --- |
116 | 59 | Etienne Pallier | |
117 | 60 | Etienne Pallier | h3. Create virtualenv with python3.5 dedicated to pyros project (inside the project folder) |
118 | 3 | Etienne Pallier | |
119 | 3 | Etienne Pallier | $ cd pyros/ |
120 | 3 | Etienne Pallier | |
121 | 3 | Etienne Pallier | $ which python3.5 |
122 | 3 | Etienne Pallier | /opt/local/bin/python3.5 |
123 | 3 | Etienne Pallier | |
124 | 15 | Etienne Pallier | $ virtualenv-3.5 venv_py35_pyros -p /opt/local/bin/python3.5 |
125 | 3 | Etienne Pallier | => creates a venv_py35_pyros/ folder inside pyros/ |
126 | 3 | Etienne Pallier | |
127 | 1 | Etienne Pallier | |
128 | 1 | Etienne Pallier | |
129 | 7 | Etienne Pallier | --- |
130 | 3 | Etienne Pallier | |
131 | 65 | Etienne Pallier | h3. Activate the python virtual environment (from inside the project) |
132 | 7 | Etienne Pallier | |
133 | 55 | Etienne Pallier | <pre> |
134 | 1 | Etienne Pallier | |
135 | 65 | Etienne Pallier | $ pwd |
136 | 65 | Etienne Pallier | .../pyros |
137 | 1 | Etienne Pallier | |
138 | 65 | Etienne Pallier | $ source ./venv_py35_pyros/bin/activate |
139 | 65 | Etienne Pallier | |
140 | 3 | Etienne Pallier | $ python -V |
141 | 1 | Etienne Pallier | Python 3.5.1 |
142 | 3 | Etienne Pallier | |
143 | 3 | Etienne Pallier | $ which pip |
144 | 65 | Etienne Pallier | .../pyros/venv_py35_pyros/bin/pip |
145 | 16 | Etienne Pallier | |
146 | 18 | Etienne Pallier | Upgrade pip to last version available : |
147 | 3 | Etienne Pallier | $ pip install --upgrade pip |
148 | 3 | Etienne Pallier | Collecting pip |
149 | 3 | Etienne Pallier | Downloading pip-8.1.1-py2.py3-none-any.whl (1.2MB) |
150 | 3 | Etienne Pallier | Installing collected packages: pip |
151 | 3 | Etienne Pallier | Found existing installation: pip 7.1.2 |
152 | 3 | Etienne Pallier | Uninstalling pip-7.1.2: |
153 | 3 | Etienne Pallier | Successfully uninstalled pip-7.1.2 |
154 | 1 | Etienne Pallier | Successfully installed pip-8.1.1 |
155 | 55 | Etienne Pallier | |
156 | 55 | Etienne Pallier | </pre> |
157 | 18 | Etienne Pallier | |
158 | 27 | Etienne Pallier | h3. Install needed python packages (from within the virtual environment) |
159 | 18 | Etienne Pallier | |
160 | 62 | Etienne Pallier | * *Automatic Installation of all packages* |
161 | 1 | Etienne Pallier | |
162 | 62 | Etienne Pallier | TODO: |
163 | 62 | Etienne Pallier | <pre> |
164 | 62 | Etienne Pallier | $ pip install -r requirements.txt |
165 | 62 | Etienne Pallier | </pre> |
166 | 62 | Etienne Pallier | |
167 | 62 | Etienne Pallier | * *Manual installation of each package* |
168 | 62 | Etienne Pallier | |
169 | 62 | Etienne Pallier | * *Install Django* : |
170 | 32 | Etienne Pallier | <pre> |
171 | 3 | Etienne Pallier | $ pip install django |
172 | 3 | Etienne Pallier | Collecting django |
173 | 3 | Etienne Pallier | Downloading Django-1.9.4-py2.py3-none-any.whl (6.6MB) |
174 | 3 | Etienne Pallier | Installing collected packages: django |
175 | 3 | Etienne Pallier | Successfully installed django-1.9.4 |
176 | 3 | Etienne Pallier | |
177 | 3 | Etienne Pallier | $ pip install django-admin-tools |
178 | 3 | Etienne Pallier | Collecting django-admin-tools |
179 | 3 | Etienne Pallier | Downloading django_admin_tools-0.7.2-py2.py3-none-any.whl (289kB) |
180 | 3 | Etienne Pallier | Installing collected packages: django-admin-tools |
181 | 3 | Etienne Pallier | Successfully installed django-admin-tools-0.7.2 |
182 | 3 | Etienne Pallier | |
183 | 21 | Etienne Pallier | $ pip install django-debug-toolbar |
184 | 21 | Etienne Pallier | Collecting django-debug-toolbar |
185 | 21 | Etienne Pallier | Downloading django_debug_toolbar-1.4-py2.py3-none-any.whl (212kB) |
186 | 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) |
187 | 21 | Etienne Pallier | Collecting sqlparse (from django-debug-toolbar) |
188 | 21 | Etienne Pallier | Downloading sqlparse-0.1.19.tar.gz (58kB) |
189 | 21 | Etienne Pallier | Building wheels for collected packages: sqlparse |
190 | 21 | Etienne Pallier | Running setup.py bdist_wheel for sqlparse ... done |
191 | 21 | Etienne Pallier | Stored in directory: /Users/epallier/Library/Caches/pip/wheels/7b/d4/72/6011bb100dd5fc213164e4bbee13d4e03261dd54ce6a5de6b8 |
192 | 21 | Etienne Pallier | Successfully built sqlparse |
193 | 21 | Etienne Pallier | Installing collected packages: sqlparse, django-debug-toolbar |
194 | 21 | Etienne Pallier | Successfully installed django-debug-toolbar-1.4 sqlparse-0.1.19 |
195 | 21 | Etienne Pallier | |
196 | 21 | Etienne Pallier | $ pip install django-extensions |
197 | 21 | Etienne Pallier | Collecting django-extensions |
198 | 21 | Etienne Pallier | Downloading django_extensions-1.6.1-py2.py3-none-any.whl (202kB) |
199 | 21 | Etienne Pallier | Collecting six>=1.2 (from django-extensions) |
200 | 21 | Etienne Pallier | Downloading six-1.10.0-py2.py3-none-any.whl |
201 | 21 | Etienne Pallier | Installing collected packages: six, django-extensions |
202 | 21 | Etienne Pallier | Successfully installed django-extensions-1.6.1 six-1.10.0 |
203 | 21 | Etienne Pallier | |
204 | 21 | Etienne Pallier | $ pip install django-suit |
205 | 21 | Etienne Pallier | Collecting django-suit |
206 | 21 | Etienne Pallier | Downloading django-suit-0.2.18.tar.gz (587kB) |
207 | 21 | Etienne Pallier | Building wheels for collected packages: django-suit |
208 | 1 | Etienne Pallier | Running setup.py bdist_wheel for django-suit ... done |
209 | 1 | Etienne Pallier | Stored in directory: /Users/epallier/Library/Caches/pip/wheels/12/8b/9a/e02ab0ad9229881638aa040d47d77c8f562999533811927d41 |
210 | 1 | Etienne Pallier | Successfully built django-suit |
211 | 1 | Etienne Pallier | Installing collected packages: django-suit |
212 | 1 | Etienne Pallier | Successfully installed django-suit-0.2.18 |
213 | 21 | Etienne Pallier | |
214 | 32 | Etienne Pallier | </pre> |
215 | 32 | Etienne Pallier | |
216 | 63 | Etienne Pallier | * *Install the web application server gunicorn (will be used in production instead of the dev django web server)* : |
217 | 32 | Etienne Pallier | <pre> |
218 | 25 | Etienne Pallier | $ pip install gunicorn |
219 | 25 | Etienne Pallier | Collecting gunicorn |
220 | 25 | Etienne Pallier | Downloading gunicorn-19.4.5-py2.py3-none-any.whl (112kB) |
221 | 21 | Etienne Pallier | Installing collected packages: gunicorn |
222 | 26 | Etienne Pallier | Successfully installed gunicorn-19.4.5 |
223 | 1 | Etienne Pallier | </pre> |
224 | 1 | Etienne Pallier | |
225 | 63 | Etienne Pallier | * *Install the python mysql client*: |
226 | 32 | Etienne Pallier | <pre> |
227 | 32 | Etienne Pallier | $ pip install mysqlclient |
228 | 32 | Etienne Pallier | ... |
229 | 32 | Etienne Pallier | </pre> |
230 | 20 | Etienne Pallier | |
231 | 33 | Etienne Pallier | => Issue under Mac OS X: |
232 | 21 | Etienne Pallier | <pre> |
233 | 20 | Etienne Pallier | |
234 | 3 | Etienne Pallier | Collecting mysqlclient |
235 | 3 | Etienne Pallier | Downloading mysqlclient-1.3.7.tar.gz (79kB) |
236 | 1 | Etienne Pallier | Building wheels for collected packages: mysqlclient |
237 | 22 | Etienne Pallier | Running setup.py bdist_wheel for mysqlclient ... error |
238 | 3 | Etienne Pallier | … |
239 | 3 | Etienne Pallier | ---------------------------------------- |
240 | 1 | Etienne Pallier | Failed building wheel for mysqlclient |
241 | 1 | Etienne Pallier | Running setup.py clean for mysqlclient |
242 | 1 | Etienne Pallier | Failed to build mysqlclient |
243 | 1 | Etienne Pallier | Installing collected packages: mysqlclient |
244 | 1 | Etienne Pallier | Running setup.py install for mysqlclient ... done |
245 | 1 | Etienne Pallier | Successfully installed mysqlclient-1.3.7 |
246 | 1 | Etienne Pallier | |
247 | 1 | Etienne Pallier | BOUH !!! |
248 | 1 | Etienne Pallier | |
249 | 1 | Etienne Pallier | $ pip install --upgrade wheel |
250 | 1 | Etienne Pallier | Collecting wheel |
251 | 1 | Etienne Pallier | Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB) |
252 | 1 | Etienne Pallier | Installing collected packages: wheel |
253 | 1 | Etienne Pallier | Found existing installation: wheel 0.24.0 |
254 | 1 | Etienne Pallier | Uninstalling wheel-0.24.0: |
255 | 1 | Etienne Pallier | Successfully uninstalled wheel-0.24.0 |
256 | 1 | Etienne Pallier | Successfully installed wheel-0.29.0 |
257 | 1 | Etienne Pallier | |
258 | 1 | Etienne Pallier | $ pip uninstall mysqlclient |
259 | 1 | Etienne Pallier | |
260 | 1 | Etienne Pallier | $ pip install mysqlclient |
261 | 1 | Etienne Pallier | Collecting mysqlclient |
262 | 1 | Etienne Pallier | Using cached mysqlclient-1.3.7.tar.gz |
263 | 1 | Etienne Pallier | Building wheels for collected packages: mysqlclient |
264 | 1 | Etienne Pallier | Running setup.py bdist_wheel for mysqlclient ... done |
265 | 1 | Etienne Pallier | Stored in directory: /Users/epallier/Library/Caches/pip/wheels/9b/06/50/d11418c26cf8f2156b13d4363b5afde8e7e75ebb8540d0228d |
266 | 1 | Etienne Pallier | Successfully built mysqlclient |
267 | 1 | Etienne Pallier | Installing collected packages: mysqlclient |
268 | 1 | Etienne Pallier | Successfully installed mysqlclient-1.3.7 |
269 | 1 | Etienne Pallier | |
270 | 1 | Etienne Pallier | YES !!! |
271 | 21 | Etienne Pallier | </pre> |
272 | 1 | Etienne Pallier | |
273 | 1 | Etienne Pallier | |
274 | 12 | Etienne Pallier | |
275 | 12 | Etienne Pallier | |
276 | 12 | Etienne Pallier | --- |
277 | 12 | Etienne Pallier | |
278 | 28 | Etienne Pallier | h3. Project organization |
279 | 12 | Etienne Pallier | |
280 | 29 | Etienne Pallier | Example of a good organization : |
281 | 1 | Etienne Pallier | |
282 | 29 | Etienne Pallier | 1 project = N applis |
283 | 29 | Etienne Pallier | (but 1 appli can be part of many projects) |
284 | 30 | Etienne Pallier | (then 1 appli = N models) |
285 | 12 | Etienne Pallier | |
286 | 31 | Etienne Pallier | <pre> |
287 | 34 | Etienne Pallier | |
288 | 29 | Etienne Pallier | MYPROJECT/ |
289 | 34 | Etienne Pallier | |
290 | 50 | Etienne Pallier | |
291 | 1 | Etienne Pallier | src/ |
292 | 1 | Etienne Pallier | myproject/ |
293 | 34 | Etienne Pallier | appli1/ |
294 | 34 | Etienne Pallier | appli2/ |
295 | 12 | Etienne Pallier | … |
296 | 34 | Etienne Pallier | appliN/ |
297 | 34 | Etienne Pallier | |
298 | 12 | Etienne Pallier | public/ |
299 | 34 | Etienne Pallier | static/ |
300 | 34 | Etienne Pallier | |
301 | 12 | Etienne Pallier | private/ |
302 | 1 | Etienne Pallier | requirements.txt |
303 | 50 | Etienne Pallier | |
304 | 50 | Etienne Pallier | venv_py35_pyros/ |
305 | 50 | Etienne Pallier | |
306 | 1 | Etienne Pallier | </pre> |
307 | 1 | Etienne Pallier | |
308 | 1 | Etienne Pallier | |
309 | 37 | Etienne Pallier | Set needed folders: |
310 | 37 | Etienne Pallier | <pre> |
311 | 37 | Etienne Pallier | $ cd pyros/ |
312 | 12 | Etienne Pallier | $ mkdir private public |
313 | 12 | Etienne Pallier | $ mkdir public/static |
314 | 37 | Etienne Pallier | </pre> |
315 | 3 | Etienne Pallier | |
316 | 7 | Etienne Pallier | --- |
317 | 3 | Etienne Pallier | |
318 | 39 | Etienne Pallier | h3. Create Django project pyros |
319 | 7 | Etienne Pallier | |
320 | 38 | Etienne Pallier | <pre> |
321 | 38 | Etienne Pallier | $ cd pyros/ |
322 | 38 | Etienne Pallier | |
323 | 3 | Etienne Pallier | $ django-admin startproject pyros |
324 | 3 | Etienne Pallier | |
325 | 3 | Etienne Pallier | $ tree pyros/ |
326 | 3 | Etienne Pallier | pyros/ |
327 | 3 | Etienne Pallier | ├── manage.py |
328 | 3 | Etienne Pallier | └── pyros |
329 | 3 | Etienne Pallier | ├── __init__.py |
330 | 3 | Etienne Pallier | ├── settings.py |
331 | 3 | Etienne Pallier | ├── urls.py |
332 | 3 | Etienne Pallier | └── wsgi.py |
333 | 3 | Etienne Pallier | |
334 | 3 | Etienne Pallier | $ mv pyros src |
335 | 3 | Etienne Pallier | |
336 | 3 | Etienne Pallier | $ cd src/ |
337 | 3 | Etienne Pallier | |
338 | 3 | Etienne Pallier | $ ./manage.py runserver |
339 | 40 | Etienne Pallier | (or gunicorn pyros.wsgi) |
340 | 1 | Etienne Pallier | ==> http://localhost:8000 |
341 | 38 | Etienne Pallier | </pre> |
342 | 3 | Etienne Pallier | |
343 | 3 | Etienne Pallier | |
344 | 7 | Etienne Pallier | --- |
345 | 3 | Etienne Pallier | |
346 | 42 | Etienne Pallier | h3. Set Database engine as MySql |
347 | 7 | Etienne Pallier | |
348 | 3 | Etienne Pallier | Edit src/pyros/settings.py |
349 | 3 | Etienne Pallier | |
350 | 41 | Etienne Pallier | <pre> |
351 | 3 | Etienne Pallier | DATABASES = { |
352 | 3 | Etienne Pallier | 'default': { |
353 | 3 | Etienne Pallier | 'ENGINE': 'django.db.backends.mysql', |
354 | 1 | Etienne Pallier | 'NAME': 'pyros', |
355 | 3 | Etienne Pallier | 'USER': 'root', |
356 | 1 | Etienne Pallier | 'PASSWORD': '' |
357 | 1 | Etienne Pallier | } |
358 | 1 | Etienne Pallier | } |
359 | 41 | Etienne Pallier | </pre> |
360 | 3 | Etienne Pallier | |
361 | 7 | Etienne Pallier | --- |
362 | 3 | Etienne Pallier | |
363 | 43 | Etienne Pallier | h3. Import database into Django (with inspectdb) |
364 | 7 | Etienne Pallier | |
365 | 43 | Etienne Pallier | $ cd src/ |
366 | 3 | Etienne Pallier | |
367 | 3 | Etienne Pallier | $ ./manage.py inspectdb > models.py |
368 | 3 | Etienne Pallier | |
369 | 44 | Etienne Pallier | *Issue on Mac OS X*: |
370 | 44 | Etienne Pallier | <pre> |
371 | 3 | Etienne Pallier | Traceback (most recent call last): |
372 | 3 | Etienne Pallier | File "/Users/epallier/Documents/_W_more/PROJECTS/GFT/SOFT/PYROS/pyros/venv_py35_pyros/lib/python3.5/site-packages/django/db/backends/mysql/base.py", line 25, in <module> |
373 | 3 | Etienne Pallier | import MySQLdb as Database |
374 | 3 | Etienne Pallier | File "/Users/epallier/Documents/_W_more/PROJECTS/GFT/SOFT/PYROS/pyros/venv_py35_pyros/lib/python3.5/site-packages/MySQLdb/__init__.py", line 19, in <module> |
375 | 3 | Etienne Pallier | import _mysql |
376 | 3 | Etienne Pallier | ImportError: dlopen(/Users/epallier/Documents/_W_more/PROJECTS/GFT/SOFT/PYROS/pyros/venv_py35_pyros/lib/python3.5/site-packages/_mysql.cpython-35m-darwin.so, 2): Library not loaded: libmysqlclient.18.dylib |
377 | 3 | Etienne Pallier | Referenced from: /Users/epallier/Documents/_W_more/PROJECTS/GFT/SOFT/PYROS/pyros/venv_py35_pyros/lib/python3.5/site-packages/_mysql.cpython-35m-darwin.so |
378 | 3 | Etienne Pallier | Reason: image not found |
379 | 3 | Etienne Pallier | |
380 | 3 | Etienne Pallier | => BOUH !!! |
381 | 3 | Etienne Pallier | |
382 | 3 | Etienne Pallier | LA SOLUTION EST ICI : http://stackoverflow.com/questions/6383310/python-mysqldb-library-not-loaded-libmysqlclient-18-dylib |
383 | 3 | Etienne Pallier | |
384 | 3 | Etienne Pallier | ( |
385 | 3 | Etienne Pallier | Apparemment, ceci aurait dû suffire: |
386 | 3 | Etienne Pallier | mkdir -p /usr/local/lib |
387 | 3 | Etienne Pallier | ln -s /usr/local/mysql/lib/libmysql* /usr/local/lib |
388 | 3 | Etienne Pallier | ) |
389 | 3 | Etienne Pallier | |
390 | 3 | Etienne Pallier | Mais j’ai fait ceci: |
391 | 3 | Etienne Pallier | |
392 | 3 | Etienne Pallier | $ otool -L /Users/epallier/Documents/_W_more/PROJECTS/GFT/SOFT/PYROS/pyros/venv_py35_pyros/lib/python3.5/site-packages/_mysql.cpython-35m-darwin.so |
393 | 3 | Etienne Pallier | /Users/epallier/Documents/_W_more/PROJECTS/GFT/SOFT/PYROS/pyros/venv_py35_pyros/lib/python3.5/site-packages/_mysql.cpython-35m-darwin.so: |
394 | 1 | Etienne Pallier | libmysqlclient.18.dylib (compatibility version 18.0.0, current version 18.0.0) |
395 | 10 | Etienne Pallier | ... |
396 | 3 | Etienne Pallier | |
397 | 3 | Etienne Pallier | $ locate libmysqlclient.18.dylib |
398 | 3 | Etienne Pallier | /Applications/XAMPP/xamppfiles/lib/libmysqlclient.18.dylib |
399 | 1 | Etienne Pallier | /Library/SystemMigration/History/Migration-68137DFB-CB6A-4FBB-81E2-11BDB5D01E48/QuarantineRoot/usr/lib/libmysqlclient.18.dylib |
400 | 1 | Etienne Pallier | |
401 | 1 | Etienne Pallier | $ sudo install_name_tool -change libmysqlclient.18.dylib /Applications/XAMPP/xamppfiles/lib/libmysqlclient.18.dylib /Users/epallier/Documents/_W_more/PROJECTS/GFT/SOFT/PYROS/pyros/venv_py35_pyros/lib/python3.5/site-packages/_mysql.cpython-35m-darwin.so |
402 | 1 | Etienne Pallier | |
403 | 10 | Etienne Pallier | $ otool -L /Users/epallier/Documents/_W_more/PROJECTS/GFT/SOFT/PYROS/pyros/venv_py35_pyros/lib/python3.5/site-packages/_mysql.cpython-35m-darwin.so |
404 | 10 | Etienne Pallier | /Users/epallier/Documents/_W_more/PROJECTS/GFT/SOFT/PYROS/pyros/venv_py35_pyros/lib/python3.5/site-packages/_mysql.cpython-35m-darwin.so: |
405 | 10 | Etienne Pallier | /Applications/XAMPP/xamppfiles/lib/libmysqlclient.18.dylib (compatibility version 18.0.0, current version 18.0.0) |
406 | 10 | Etienne Pallier | ... |
407 | 3 | Etienne Pallier | |
408 | 1 | Etienne Pallier | $ ./manage.py inspectdb > models.py |
409 | 1 | Etienne Pallier | |
410 | 3 | Etienne Pallier | => YES !!! |
411 | 44 | Etienne Pallier | </pre> |
412 | 3 | Etienne Pallier | |
413 | 3 | Etienne Pallier | |
414 | 7 | Etienne Pallier | --- |
415 | 3 | Etienne Pallier | |
416 | 48 | Etienne Pallier | h3. Create a Django application pyrosapp |
417 | 7 | Etienne Pallier | |
418 | 3 | Etienne Pallier | $ ./manage.py startapp pyrosapp |
419 | 3 | Etienne Pallier | |
420 | 3 | Etienne Pallier | $ tree src |
421 | 3 | Etienne Pallier | src |
422 | 3 | Etienne Pallier | ├── manage.py |
423 | 3 | Etienne Pallier | ├── pyros |
424 | 3 | Etienne Pallier | │ ├── __init__.py |
425 | 3 | Etienne Pallier | │ ├── __pycache__ |
426 | 3 | Etienne Pallier | │ │ ├── __init__.cpython-35.pyc |
427 | 3 | Etienne Pallier | │ │ ├── settings.cpython-35.pyc |
428 | 3 | Etienne Pallier | │ │ ├── urls.cpython-35.pyc |
429 | 3 | Etienne Pallier | │ │ └── wsgi.cpython-35.pyc |
430 | 3 | Etienne Pallier | │ ├── settings.py |
431 | 3 | Etienne Pallier | │ ├── urls.py |
432 | 3 | Etienne Pallier | │ └── wsgi.py |
433 | 3 | Etienne Pallier | └── pyrosapp |
434 | 3 | Etienne Pallier | ├── __init__.py |
435 | 1 | Etienne Pallier | ├── admin.py |
436 | 3 | Etienne Pallier | ├── apps.py |
437 | 1 | Etienne Pallier | ├── migrations |
438 | 1 | Etienne Pallier | │ └── __init__.py |
439 | 3 | Etienne Pallier | ├── models.py |
440 | 3 | Etienne Pallier | ├── tests.py |
441 | 3 | Etienne Pallier | └── views.py |
442 | 1 | Etienne Pallier | |
443 | 1 | Etienne Pallier | |
444 | 7 | Etienne Pallier | --- |
445 | 1 | Etienne Pallier | |
446 | 7 | Etienne Pallier | h3. Replace the default pyrosapp models.py with the inspectdb generated one |
447 | 7 | Etienne Pallier | |
448 | 3 | Etienne Pallier | $ mv models.py pyrosapp/ |
449 | 3 | Etienne Pallier | |
450 | 3 | Etienne Pallier | |
451 | 3 | Etienne Pallier | |
452 | 3 | Etienne Pallier | |
453 | 7 | Etienne Pallier | |
454 | 1 | Etienne Pallier | --- |
455 | 9 | Etienne Pallier | |
456 | 47 | Etienne Pallier | h3. *TODO: Fix and improve the inspectdb generated file models.py* |
457 | 3 | Etienne Pallier | |
458 | 3 | Etienne Pallier | $ cd pyrosapp/ |
459 | 3 | Etienne Pallier | |
460 | 8 | Etienne Pallier | $ vi models.py |