Wiki

Version 73 (Etienne Pallier, 03/18/2016 12:32 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 68 Etienne Pallier
<pre>
105 13 Etienne Pallier
$ mkdir pyros
106 68 Etienne Pallier
</pre>
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 66 Etienne Pallier
First, be sure that the virtual environment is activated:
161 66 Etienne Pallier
<pre>
162 66 Etienne Pallier
$ python -V
163 66 Etienne Pallier
Python 3.5.1
164 66 Etienne Pallier
</pre>
165 66 Etienne Pallier
166 62 Etienne Pallier
 * *Automatic Installation of all packages*
167 1 Etienne Pallier
168 62 Etienne Pallier
TODO:
169 62 Etienne Pallier
<pre>
170 62 Etienne Pallier
$ pip install -r requirements.txt
171 62 Etienne Pallier
</pre>
172 62 Etienne Pallier
173 62 Etienne Pallier
 * *Manual installation of each package*
174 62 Etienne Pallier
175 62 Etienne Pallier
  * *Install Django* :
176 32 Etienne Pallier
<pre>
177 3 Etienne Pallier
$ pip install django
178 3 Etienne Pallier
Collecting django
179 3 Etienne Pallier
  Downloading Django-1.9.4-py2.py3-none-any.whl (6.6MB)
180 3 Etienne Pallier
Installing collected packages: django
181 3 Etienne Pallier
Successfully installed django-1.9.4
182 3 Etienne Pallier
183 3 Etienne Pallier
$ pip install django-admin-tools
184 3 Etienne Pallier
Collecting django-admin-tools
185 3 Etienne Pallier
  Downloading django_admin_tools-0.7.2-py2.py3-none-any.whl (289kB)
186 3 Etienne Pallier
Installing collected packages: django-admin-tools
187 3 Etienne Pallier
Successfully installed django-admin-tools-0.7.2
188 3 Etienne Pallier
189 21 Etienne Pallier
$ pip install django-debug-toolbar
190 21 Etienne Pallier
Collecting django-debug-toolbar
191 21 Etienne Pallier
  Downloading django_debug_toolbar-1.4-py2.py3-none-any.whl (212kB)
192 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)
193 21 Etienne Pallier
Collecting sqlparse (from django-debug-toolbar)
194 21 Etienne Pallier
  Downloading sqlparse-0.1.19.tar.gz (58kB)
195 21 Etienne Pallier
Building wheels for collected packages: sqlparse
196 21 Etienne Pallier
  Running setup.py bdist_wheel for sqlparse ... done
197 21 Etienne Pallier
  Stored in directory: /Users/epallier/Library/Caches/pip/wheels/7b/d4/72/6011bb100dd5fc213164e4bbee13d4e03261dd54ce6a5de6b8
198 21 Etienne Pallier
Successfully built sqlparse
199 21 Etienne Pallier
Installing collected packages: sqlparse, django-debug-toolbar
200 21 Etienne Pallier
Successfully installed django-debug-toolbar-1.4 sqlparse-0.1.19
201 21 Etienne Pallier
202 21 Etienne Pallier
$ pip install django-extensions
203 21 Etienne Pallier
Collecting django-extensions
204 21 Etienne Pallier
  Downloading django_extensions-1.6.1-py2.py3-none-any.whl (202kB)
205 21 Etienne Pallier
Collecting six>=1.2 (from django-extensions)
206 21 Etienne Pallier
  Downloading six-1.10.0-py2.py3-none-any.whl
207 21 Etienne Pallier
Installing collected packages: six, django-extensions
208 21 Etienne Pallier
Successfully installed django-extensions-1.6.1 six-1.10.0
209 21 Etienne Pallier
210 21 Etienne Pallier
$ pip install django-suit
211 21 Etienne Pallier
Collecting django-suit
212 21 Etienne Pallier
  Downloading django-suit-0.2.18.tar.gz (587kB)
213 21 Etienne Pallier
Building wheels for collected packages: django-suit
214 1 Etienne Pallier
  Running setup.py bdist_wheel for django-suit ... done
215 1 Etienne Pallier
  Stored in directory: /Users/epallier/Library/Caches/pip/wheels/12/8b/9a/e02ab0ad9229881638aa040d47d77c8f562999533811927d41
216 1 Etienne Pallier
Successfully built django-suit
217 1 Etienne Pallier
Installing collected packages: django-suit
218 1 Etienne Pallier
Successfully installed django-suit-0.2.18
219 21 Etienne Pallier
220 32 Etienne Pallier
</pre>
221 32 Etienne Pallier
222 63 Etienne Pallier
  * *Install the web application server gunicorn (will be used in production instead of the dev django web server)* :
223 32 Etienne Pallier
<pre>
224 25 Etienne Pallier
$ pip install gunicorn
225 25 Etienne Pallier
Collecting gunicorn
226 25 Etienne Pallier
  Downloading gunicorn-19.4.5-py2.py3-none-any.whl (112kB)
227 21 Etienne Pallier
Installing collected packages: gunicorn
228 26 Etienne Pallier
Successfully installed gunicorn-19.4.5
229 1 Etienne Pallier
</pre>
230 1 Etienne Pallier
231 63 Etienne Pallier
  * *Install the python mysql client*:
232 32 Etienne Pallier
<pre>
233 32 Etienne Pallier
$ pip install mysqlclient
234 72 Etienne Pallier
...
235 72 Etienne Pallier
</pre>
236 33 Etienne Pallier
237 73 Etienne Pallier
   * => Issue under Mac OS X:
238 72 Etienne Pallier
<pre>
239 3 Etienne Pallier
$ pip install mysqlclient
240 3 Etienne Pallier
Collecting mysqlclient
241 1 Etienne Pallier
  Downloading mysqlclient-1.3.7.tar.gz (79kB)
242 22 Etienne Pallier
Building wheels for collected packages: mysqlclient
243 3 Etienne Pallier
  Running setup.py bdist_wheel for mysqlclient ... error
244 3 Etienne Pallier
245 1 Etienne Pallier
  ----------------------------------------
246 1 Etienne Pallier
  Failed building wheel for mysqlclient
247 1 Etienne Pallier
  Running setup.py clean for mysqlclient
248 1 Etienne Pallier
Failed to build mysqlclient
249 1 Etienne Pallier
Installing collected packages: mysqlclient
250 1 Etienne Pallier
  Running setup.py install for mysqlclient ... done
251 1 Etienne Pallier
Successfully installed mysqlclient-1.3.7
252 1 Etienne Pallier
253 1 Etienne Pallier
BOUH !!!
254 1 Etienne Pallier
255 1 Etienne Pallier
$ pip install --upgrade wheel
256 1 Etienne Pallier
Collecting wheel
257 1 Etienne Pallier
  Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
258 1 Etienne Pallier
Installing collected packages: wheel
259 1 Etienne Pallier
  Found existing installation: wheel 0.24.0
260 1 Etienne Pallier
    Uninstalling wheel-0.24.0:
261 1 Etienne Pallier
      Successfully uninstalled wheel-0.24.0
262 1 Etienne Pallier
Successfully installed wheel-0.29.0
263 1 Etienne Pallier
264 1 Etienne Pallier
$ pip uninstall mysqlclient
265 1 Etienne Pallier
266 1 Etienne Pallier
$ pip install mysqlclient
267 1 Etienne Pallier
Collecting mysqlclient
268 1 Etienne Pallier
  Using cached mysqlclient-1.3.7.tar.gz
269 1 Etienne Pallier
Building wheels for collected packages: mysqlclient
270 1 Etienne Pallier
  Running setup.py bdist_wheel for mysqlclient ... done
271 1 Etienne Pallier
  Stored in directory: /Users/epallier/Library/Caches/pip/wheels/9b/06/50/d11418c26cf8f2156b13d4363b5afde8e7e75ebb8540d0228d
272 1 Etienne Pallier
Successfully built mysqlclient
273 1 Etienne Pallier
Installing collected packages: mysqlclient
274 1 Etienne Pallier
Successfully installed mysqlclient-1.3.7
275 1 Etienne Pallier
276 71 Etienne Pallier
YES !!!
277 21 Etienne Pallier
278 1 Etienne Pallier
</pre>
279 1 Etienne Pallier
280 12 Etienne Pallier
281 12 Etienne Pallier
282 12 Etienne Pallier
283 12 Etienne Pallier
---
284 28 Etienne Pallier
285 12 Etienne Pallier
h3. Project organization
286 29 Etienne Pallier
 
287 1 Etienne Pallier
Example of a good organization :
288 29 Etienne Pallier
289 29 Etienne Pallier
1 project = N applis
290 30 Etienne Pallier
(but 1 appli can be part of many projects)
291 12 Etienne Pallier
(then 1 appli = N models)
292 31 Etienne Pallier
293 34 Etienne Pallier
<pre>
294 29 Etienne Pallier
295 34 Etienne Pallier
MYPROJECT/
296 50 Etienne Pallier
297 1 Etienne Pallier
298 1 Etienne Pallier
	src/
299 34 Etienne Pallier
		myproject/
300 34 Etienne Pallier
		appli1/
301 12 Etienne Pallier
		appli2/
302 34 Etienne Pallier
303 34 Etienne Pallier
		appliN/
304 12 Etienne Pallier
305 34 Etienne Pallier
	public/
306 34 Etienne Pallier
		static/
307 12 Etienne Pallier
308 1 Etienne Pallier
	private/
309 50 Etienne Pallier
		requirements.txt
310 50 Etienne Pallier
311 50 Etienne Pallier
	venv_py35_pyros/
312 1 Etienne Pallier
313 1 Etienne Pallier
</pre>
314 1 Etienne Pallier
315 37 Etienne Pallier
316 37 Etienne Pallier
Set needed folders:
317 37 Etienne Pallier
<pre>
318 12 Etienne Pallier
$ cd pyros/
319 12 Etienne Pallier
$ mkdir private public
320 37 Etienne Pallier
$ mkdir public/static
321 3 Etienne Pallier
</pre>
322 7 Etienne Pallier
323 3 Etienne Pallier
---
324 39 Etienne Pallier
325 7 Etienne Pallier
h3. Create Django project pyros
326 38 Etienne Pallier
327 38 Etienne Pallier
<pre>
328 38 Etienne Pallier
$ cd pyros/
329 3 Etienne Pallier
330 3 Etienne Pallier
$ django-admin startproject pyros
331 3 Etienne Pallier
332 3 Etienne Pallier
$ tree pyros/
333 3 Etienne Pallier
pyros/
334 3 Etienne Pallier
├── manage.py
335 3 Etienne Pallier
└── pyros
336 3 Etienne Pallier
    ├── __init__.py
337 3 Etienne Pallier
    ├── settings.py
338 3 Etienne Pallier
    ├── urls.py
339 3 Etienne Pallier
    └── wsgi.py
340 3 Etienne Pallier
341 3 Etienne Pallier
$ mv pyros src
342 3 Etienne Pallier
343 3 Etienne Pallier
$ cd src/
344 3 Etienne Pallier
345 40 Etienne Pallier
$ ./manage.py runserver
346 1 Etienne Pallier
(or gunicorn pyros.wsgi)
347 38 Etienne Pallier
==> http://localhost:8000
348 3 Etienne Pallier
</pre>
349 3 Etienne Pallier
350 7 Etienne Pallier
351 3 Etienne Pallier
---
352 42 Etienne Pallier
353 7 Etienne Pallier
h3. Set Database engine as MySql
354 3 Etienne Pallier
355 3 Etienne Pallier
Edit src/pyros/settings.py
356 41 Etienne Pallier
357 3 Etienne Pallier
<pre>
358 3 Etienne Pallier
DATABASES = {
359 3 Etienne Pallier
    'default': {
360 1 Etienne Pallier
        'ENGINE': 'django.db.backends.mysql',
361 3 Etienne Pallier
        'NAME': 'pyros',
362 1 Etienne Pallier
        'USER': 'root',
363 1 Etienne Pallier
        'PASSWORD': ''
364 1 Etienne Pallier
    }
365 41 Etienne Pallier
}
366 3 Etienne Pallier
</pre>
367 7 Etienne Pallier
368 3 Etienne Pallier
---
369 43 Etienne Pallier
370 7 Etienne Pallier
h3. Import database into Django (with inspectdb)
371 43 Etienne Pallier
372 3 Etienne Pallier
$ cd src/
373 3 Etienne Pallier
374 3 Etienne Pallier
$ ./manage.py inspectdb > models.py
375 44 Etienne Pallier
376 44 Etienne Pallier
*Issue on Mac OS X*:
377 3 Etienne Pallier
<pre>
378 3 Etienne Pallier
Traceback (most recent call last):
379 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>
380 3 Etienne Pallier
    import MySQLdb as Database
381 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>
382 3 Etienne Pallier
    import _mysql
383 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
384 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
385 3 Etienne Pallier
  Reason: image not found
386 3 Etienne Pallier
387 3 Etienne Pallier
=> BOUH !!!
388 3 Etienne Pallier
389 3 Etienne Pallier
LA SOLUTION EST ICI : http://stackoverflow.com/questions/6383310/python-mysqldb-library-not-loaded-libmysqlclient-18-dylib
390 3 Etienne Pallier
391 3 Etienne Pallier
(
392 3 Etienne Pallier
Apparemment, ceci aurait dû suffire:
393 3 Etienne Pallier
mkdir -p /usr/local/lib   
394 3 Etienne Pallier
ln -s /usr/local/mysql/lib/libmysql* /usr/local/lib
395 3 Etienne Pallier
)
396 3 Etienne Pallier
397 3 Etienne Pallier
Mais j’ai fait ceci:
398 3 Etienne Pallier
399 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
400 1 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:
401 10 Etienne Pallier
	libmysqlclient.18.dylib (compatibility version 18.0.0, current version 18.0.0)
402 3 Etienne Pallier
...
403 3 Etienne Pallier
404 3 Etienne Pallier
$ locate libmysqlclient.18.dylib
405 1 Etienne Pallier
/Applications/XAMPP/xamppfiles/lib/libmysqlclient.18.dylib
406 1 Etienne Pallier
/Library/SystemMigration/History/Migration-68137DFB-CB6A-4FBB-81E2-11BDB5D01E48/QuarantineRoot/usr/lib/libmysqlclient.18.dylib
407 1 Etienne Pallier
408 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
409 10 Etienne Pallier
410 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
411 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:
412 10 Etienne Pallier
	/Applications/XAMPP/xamppfiles/lib/libmysqlclient.18.dylib (compatibility version 18.0.0, current version 18.0.0)
413 3 Etienne Pallier
...
414 1 Etienne Pallier
415 1 Etienne Pallier
$ ./manage.py inspectdb > models.py
416 3 Etienne Pallier
417 44 Etienne Pallier
=> YES !!!
418 3 Etienne Pallier
</pre>
419 3 Etienne Pallier
420 7 Etienne Pallier
421 3 Etienne Pallier
---
422 48 Etienne Pallier
423 7 Etienne Pallier
h3. Create a Django application pyrosapp
424 3 Etienne Pallier
425 3 Etienne Pallier
$ ./manage.py startapp pyrosapp
426 3 Etienne Pallier
427 67 Etienne Pallier
$ tree src
428 3 Etienne Pallier
<pre>
429 3 Etienne Pallier
src
430 3 Etienne Pallier
├── manage.py
431 3 Etienne Pallier
├── pyros
432 3 Etienne Pallier
│   ├── __init__.py
433 3 Etienne Pallier
│   ├── __pycache__
434 3 Etienne Pallier
│   │   ├── __init__.cpython-35.pyc
435 3 Etienne Pallier
│   │   ├── settings.cpython-35.pyc
436 3 Etienne Pallier
│   │   ├── urls.cpython-35.pyc
437 3 Etienne Pallier
│   │   └── wsgi.cpython-35.pyc
438 3 Etienne Pallier
│   ├── settings.py
439 3 Etienne Pallier
│   ├── urls.py
440 3 Etienne Pallier
│   └── wsgi.py
441 3 Etienne Pallier
└── pyrosapp
442 1 Etienne Pallier
    ├── __init__.py
443 3 Etienne Pallier
    ├── admin.py
444 1 Etienne Pallier
    ├── apps.py
445 1 Etienne Pallier
    ├── migrations
446 3 Etienne Pallier
    │   └── __init__.py
447 3 Etienne Pallier
    ├── models.py
448 1 Etienne Pallier
    ├── tests.py
449 67 Etienne Pallier
    └── views.py
450 1 Etienne Pallier
</pre>
451 7 Etienne Pallier
452 1 Etienne Pallier
---
453 7 Etienne Pallier
454 7 Etienne Pallier
h3. Replace the default pyrosapp models.py with the inspectdb generated one
455 3 Etienne Pallier
456 3 Etienne Pallier
$ mv models.py pyrosapp/
457 3 Etienne Pallier
458 3 Etienne Pallier
459 3 Etienne Pallier
460 7 Etienne Pallier
461 1 Etienne Pallier
462 9 Etienne Pallier
---
463 47 Etienne Pallier
464 3 Etienne Pallier
h3. *TODO: Fix and improve the inspectdb generated file models.py*
465 3 Etienne Pallier
466 3 Etienne Pallier
$ cd pyrosapp/
467 8 Etienne Pallier
468 1 Etienne Pallier
$ vi models.py