Project Installation
Version 176 (Etienne Pallier, 04/27/2016 11:25 pm)
1 | 1 | Etienne Pallier | h1. Project Installation |
---|---|---|---|
2 | 1 | Etienne Pallier | |
3 | 6 | Etienne Pallier | |
4 | 11 | Etienne Pallier | Project Development page : [[Project Development]] |
5 | 11 | Etienne Pallier | |
6 | 6 | Etienne Pallier | HOWTO Format Redmine Wiki : http://www.redmine.org/projects/redmine/wiki/FrRedmineWikiFormatting |
7 | 6 | Etienne Pallier | |
8 | 6 | Etienne Pallier | {{>toc}} |
9 | 6 | Etienne Pallier | |
10 | 6 | Etienne Pallier | |
11 | 3 | Etienne Pallier | --- |
12 | 3 | Etienne Pallier | |
13 | 170 | Etienne Pallier | --- |
14 | 170 | Etienne Pallier | |
15 | 4 | Etienne Pallier | h2. %{margin-left:0px; font-weight:bold; font-size:25px; display:block; color:red;}I - DATABASE SCHEMA (v0.2.1)% |
16 | 4 | Etienne Pallier | |
17 | 4 | Etienne Pallier | |
18 | 4 | Etienne Pallier | {{thumbnail(PYROS_PDM_v021.png, size=300, title=Pyros data model)}} |
19 | 4 | Etienne Pallier | |
20 | 4 | Etienne Pallier | |
21 | 4 | Etienne Pallier | --- |
22 | 5 | Etienne Pallier | |
23 | 170 | Etienne Pallier | --- |
24 | 170 | Etienne Pallier | |
25 | 113 | Etienne Pallier | h2. %{margin-left:0px; font-weight:bold; font-size:25px; display:block; color:red;}II - GET THE PYROS SOFTWARE% |
26 | 5 | Etienne Pallier | |
27 | 125 | Etienne Pallier | h3. Authenticate to https://gitlab.irap.omp.eu/epallier/pyros |
28 | 125 | Etienne Pallier | |
29 | 125 | Etienne Pallier | In order to get this software, you must first authenticate on the IRAP gitlab. |
30 | 125 | Etienne Pallier | |
31 | 125 | Etienne Pallier | For this, just go to https://gitlab.irap.omp.eu/epallier/pyros |
32 | 125 | Etienne Pallier | and either sign in with your LDAP account (if you are from IRAP), |
33 | 125 | Etienne Pallier | or register via the "Sign up" form. |
34 | 5 | Etienne Pallier | |
35 | 113 | Etienne Pallier | h3. Software structure |
36 | 5 | Etienne Pallier | |
37 | 156 | Paul Carensac | Once you have fetched the project, you should obtain AT LEAST this structure: |
38 | 5 | Etienne Pallier | |
39 | 5 | Etienne Pallier | <pre> |
40 | 5 | Etienne Pallier | |
41 | 5 | Etienne Pallier | PYROS/ |
42 | 5 | Etienne Pallier | ├── install/ |
43 | 5 | Etienne Pallier | │ └── REQUIREMENTS.txt |
44 | 5 | Etienne Pallier | │ └── INSTALLATION.txt |
45 | 5 | Etienne Pallier | ├── public/ |
46 | 5 | Etienne Pallier | │ └── static/ |
47 | 5 | Etienne Pallier | ├── src/ |
48 | 5 | Etienne Pallier | │ ├── manage.py |
49 | 5 | Etienne Pallier | │ ├── pyros/ |
50 | 5 | Etienne Pallier | │ │ ├── __init__.py |
51 | 5 | Etienne Pallier | │ │ ├── __pycache__ |
52 | 5 | Etienne Pallier | │ │ ├── settings.py |
53 | 5 | Etienne Pallier | │ │ ├── urls.py |
54 | 5 | Etienne Pallier | │ │ └── wsgi.py |
55 | 5 | Etienne Pallier | │ └── pyrosapp/ |
56 | 5 | Etienne Pallier | │ ├── __init__.py |
57 | 5 | Etienne Pallier | │ ├── admin.py |
58 | 5 | Etienne Pallier | │ ├── apps.py |
59 | 5 | Etienne Pallier | │ ├── migrations |
60 | 5 | Etienne Pallier | │ ├── models.py |
61 | 5 | Etienne Pallier | │ ├── tests.py |
62 | 5 | Etienne Pallier | │ └── views.py |
63 | 5 | Etienne Pallier | |
64 | 1 | Etienne Pallier | |
65 | 1 | Etienne Pallier | </pre> |
66 | 1 | Etienne Pallier | |
67 | 112 | Etienne Pallier | h3. Browse the code (from gitlab) |
68 | 111 | Etienne Pallier | |
69 | 111 | Etienne Pallier | https://gitlab.irap.omp.eu/epallier/pyros/tree/master |
70 | 111 | Etienne Pallier | |
71 | 113 | Etienne Pallier | h3. Download it (static version, not synchronized) |
72 | 111 | Etienne Pallier | |
73 | 114 | Etienne Pallier | You can download the current version of the software. |
74 | 114 | Etienne Pallier | |
75 | 115 | Etienne Pallier | Go to https://gitlab.irap.omp.eu/epallier/pyros/tree/master |
76 | 115 | Etienne Pallier | |
77 | 115 | Etienne Pallier | Click on "Download zip" on the up right hand corner. |
78 | 115 | Etienne Pallier | |
79 | 115 | Etienne Pallier | Double-click on it to unzip it. |
80 | 115 | Etienne Pallier | |
81 | 115 | Etienne Pallier | You should get a "pyros.git" folder. |
82 | 115 | Etienne Pallier | |
83 | 116 | Etienne Pallier | In this documentation, this software folder will be referenced as "PYROS". |
84 | 115 | Etienne Pallier | |
85 | 118 | Etienne Pallier | (you can rename "pyros.git" as "PYROS" if you want : "mv pyros.git PYROS") |
86 | 114 | Etienne Pallier | |
87 | 113 | Etienne Pallier | h3. Get it from GIT (dynamic version, synchronized) |
88 | 114 | Etienne Pallier | |
89 | 122 | Etienne Pallier | (If you are using Windows, you must first get the git software, see below "Get git for Windows") |
90 | 122 | Etienne Pallier | |
91 | 114 | Etienne Pallier | By getting the software from git, you will get a dynamically synchronized version, |
92 | 114 | Etienne Pallier | which means that you will be able to update your version as soon as a new version is available |
93 | 114 | Etienne Pallier | (with the command : "git pull"). |
94 | 111 | Etienne Pallier | |
95 | 111 | Etienne Pallier | * From Eclipse : See below, section "NOTES FOR ECLIPSE USERS" |
96 | 111 | Etienne Pallier | |
97 | 111 | Etienne Pallier | * From the terminal |
98 | 5 | Etienne Pallier | |
99 | 5 | Etienne Pallier | <pre> |
100 | 5 | Etienne Pallier | git clone https://gitlab.irap.omp.eu/epallier/pyros.git PYROS |
101 | 1 | Etienne Pallier | </pre> |
102 | 86 | Etienne Pallier | |
103 | 86 | Etienne Pallier | _(or also : git clone git@gitlab.irap.omp.eu:epallier/pyros.git PYROS)_ |
104 | 5 | Etienne Pallier | |
105 | 126 | Etienne Pallier | If you ever get this error message : |
106 | 126 | Etienne Pallier | <pre> |
107 | 126 | Etienne Pallier | fatal: unable to access 'https://gitlab.irap.omp.eu/epallier/pyros.git/': Peer's certificate issuer has been marked as not trusted by the user. |
108 | 126 | Etienne Pallier | </pre> |
109 | 126 | Etienne Pallier | |
110 | 126 | Etienne Pallier | Then, type this command (and then run again the git clone command): |
111 | 126 | Etienne Pallier | <pre> |
112 | 126 | Etienne Pallier | $ git config --global http.sslVerify false |
113 | 126 | Etienne Pallier | </pre> |
114 | 126 | Etienne Pallier | |
115 | 126 | Etienne Pallier | (Also, the first time you get the project, it will ask you for a login and password) |
116 | 124 | Etienne Pallier | |
117 | 5 | Etienne Pallier | This creates a PYROS/ folder containing the project (with a .git/ subfolder for synchronization with the git repository) |
118 | 1 | Etienne Pallier | |
119 | 1 | Etienne Pallier | |
120 | 122 | Etienne Pallier | h4. (Windows only) : Get git for Windows |
121 | 122 | Etienne Pallier | |
122 | 122 | Etienne Pallier | * Download git at https://git-scm.com/download/win |
123 | 121 | Paul Carensac | * Run setup (keep default configurations) |
124 | 121 | Paul Carensac | * Once installed, open cmd |
125 | 121 | Paul Carensac | <pre> |
126 | 121 | Paul Carensac | $ git config --global http.sslVerify false |
127 | 1 | Etienne Pallier | </pre> |
128 | 121 | Paul Carensac | |
129 | 168 | Etienne Pallier | You can now use your git from the cmd or the graphic client ! |
130 | 168 | Etienne Pallier | |
131 | 168 | Etienne Pallier | |
132 | 169 | Etienne Pallier | |
133 | 169 | Etienne Pallier | |
134 | 169 | Etienne Pallier | --- |
135 | 169 | Etienne Pallier | |
136 | 169 | Etienne Pallier | --- |
137 | 169 | Etienne Pallier | |
138 | 166 | Etienne Pallier | h2. %{margin-left:0px; font-weight:bold; font-size:25px; display:block; color:red;}IV - INSTALLATION OF NEEDED PYTHON DEPENDENCIES% |
139 | 166 | Etienne Pallier | |
140 | 166 | Etienne Pallier | Install the needed Python dependencies and the database (within a Python virtual environment) |
141 | 98 | Etienne Pallier | |
142 | 136 | Etienne Pallier | Go into the PYROS/install/ folder and Run the install_requirements.sh script. |
143 | 1 | Etienne Pallier | |
144 | 136 | Etienne Pallier | (You will be prompted to enter a username, an email, and a password for the superuser) |
145 | 136 | Etienne Pallier | |
146 | 1 | Etienne Pallier | * Mac and Linux: |
147 | 110 | Paul Carensac | <pre> |
148 | 110 | Paul Carensac | ./install_requirements.sh |
149 | 1 | Etienne Pallier | </pre> |
150 | 107 | Etienne Pallier | |
151 | 134 | Etienne Pallier | * Windows: |
152 | 135 | Etienne Pallier | <pre> |
153 | 134 | Etienne Pallier | install_requirements_windows.bat |
154 | 107 | Etienne Pallier | </pre> |
155 | 98 | Etienne Pallier | |
156 | 98 | Etienne Pallier | _If something goes wrong, install manually each package (see section "MANUAL INSTALLATION OF PYTHON PACKAGES, ONE BY ONE")_ |
157 | 98 | Etienne Pallier | |
158 | 9 | Etienne Pallier | --- |
159 | 9 | Etienne Pallier | |
160 | 9 | Etienne Pallier | h3. (Eclipse only) Set the Python3 virtual environment as the project interpreter |
161 | 9 | Etienne Pallier | |
162 | 65 | Etienne Pallier | See below, in section "NOTES FOR ECLIPSE USERS" |
163 | 9 | Etienne Pallier | |
164 | 1 | Etienne Pallier | --- |
165 | 1 | Etienne Pallier | |
166 | 170 | Etienne Pallier | --- |
167 | 170 | Etienne Pallier | |
168 | 17 | Etienne Pallier | h2. %{margin-left:0px; font-weight:bold; font-size:25px; display:block; color:red;}IV - TEST% |
169 | 17 | Etienne Pallier | |
170 | 108 | Etienne Pallier | |
171 | 90 | Etienne Pallier | (Tests are classes declared in all apps' test.py file. The test classes inherit from django.test.TestCase) |
172 | 17 | Etienne Pallier | |
173 | 17 | Etienne Pallier | You can run the tests suite, just to be sure that the software is well installed. |
174 | 17 | Etienne Pallier | |
175 | 19 | Etienne Pallier | h3. From Terminal |
176 | 19 | Etienne Pallier | |
177 | 19 | Etienne Pallier | |
178 | 1 | Etienne Pallier | <pre> |
179 | 1 | Etienne Pallier | |
180 | 94 | Etienne Pallier | $ cd PYROS/ |
181 | 20 | Etienne Pallier | |
182 | 159 | Paul Carensac | $ ./pyrosrun test |
183 | 94 | Etienne Pallier | Ran 5 tests in 0.093s |
184 | 21 | Etienne Pallier | OK |
185 | 17 | Etienne Pallier | </pre> |
186 | 19 | Etienne Pallier | |
187 | 160 | Paul Carensac | h3. From Eclipse |
188 | 1 | Etienne Pallier | |
189 | 77 | Etienne Pallier | See below, in section "NOTES FOR ECLIPSE USERS" |
190 | 25 | Paul Carensac | |
191 | 25 | Paul Carensac | |
192 | 160 | Paul Carensac | h3. Custom commands |
193 | 27 | Paul Carensac | |
194 | 25 | Paul Carensac | $ [./manage.py] test app.tests # Run tests for the application 'app' |
195 | 25 | Paul Carensac | $ [./manage.py] test app.tests.ModelTests # Run test methods declared in the class app.tests.ModelTests |
196 | 25 | Paul Carensac | $ [./manage.py] test app.tests.ModelTests.test_method # Only run the method test_method declared in app.tests.ModelTests |
197 | 33 | Etienne Pallier | |
198 | 33 | Etienne Pallier | |
199 | 1 | Etienne Pallier | --- |
200 | 1 | Etienne Pallier | |
201 | 170 | Etienne Pallier | --- |
202 | 170 | Etienne Pallier | |
203 | 92 | Etienne Pallier | h2. %{margin-left:0px; font-weight:bold; font-size:25px; display:block; color:red;}V - RUN% |
204 | 75 | Etienne Pallier | |
205 | 109 | Etienne Pallier | |
206 | 75 | Etienne Pallier | * From the terminal |
207 | 75 | Etienne Pallier | |
208 | 75 | Etienne Pallier | <pre> |
209 | 75 | Etienne Pallier | |
210 | 95 | Etienne Pallier | $ cd PYROS/ |
211 | 1 | Etienne Pallier | |
212 | 158 | Paul Carensac | $ ./pyrosrun server |
213 | 93 | Paul Carensac | </pre> |
214 | 75 | Etienne Pallier | |
215 | 158 | Paul Carensac | Now, go to "http://localhost:8000/admin" in your browser |
216 | 91 | Etienne Pallier | |
217 | 158 | Paul Carensac | (and login as "pyros" with the password 'DjangoPyros') |
218 | 105 | Etienne Pallier | |
219 | 91 | Etienne Pallier | (Ctrl-c to stop) |
220 | 91 | Etienne Pallier | |
221 | 91 | Etienne Pallier | |
222 | 75 | Etienne Pallier | |
223 | 106 | Etienne Pallier | * From Eclipse : see below, in section "NOTES FOR ECLIPSE USERS" |
224 | 75 | Etienne Pallier | |
225 | 75 | Etienne Pallier | |
226 | 1 | Etienne Pallier | --- |
227 | 1 | Etienne Pallier | |
228 | 170 | Etienne Pallier | --- |
229 | 170 | Etienne Pallier | |
230 | 33 | Etienne Pallier | h2. %{margin-left:0px; font-weight:bold; font-size:25px; display:block; color:red;}NOTES FOR ECLIPSE USERS% |
231 | 35 | Etienne Pallier | |
232 | 35 | Etienne Pallier | 0) Install Eclipse (if necessary) |
233 | 35 | Etienne Pallier | |
234 | 35 | Etienne Pallier | Get the Eclipse version for Php |
235 | 35 | Etienne Pallier | |
236 | 35 | Etienne Pallier | Install the plug-in pydev (via install new software, add http://pydev.org/updates) |
237 | 35 | Etienne Pallier | |
238 | 35 | Etienne Pallier | Install the django template editor (via install new software, add http://eclipse.kacprzak.org/updates) |
239 | 35 | Etienne Pallier | |
240 | 35 | Etienne Pallier | 1) Deactivate CA certificate verification |
241 | 35 | Etienne Pallier | |
242 | 35 | Etienne Pallier | Window -> Preferences -> Team -> git -> configuration -> Add entry |
243 | 35 | Etienne Pallier | |
244 | 35 | Etienne Pallier | Key = http.sslVerify |
245 | 35 | Etienne Pallier | Value = false |
246 | 35 | Etienne Pallier | |
247 | 35 | Etienne Pallier | 2) Fetch the project |
248 | 35 | Etienne Pallier | |
249 | 35 | Etienne Pallier | File/Import project from git |
250 | 35 | Etienne Pallier | |
251 | 35 | Etienne Pallier | Select repository source: Clone URI: https://gitlab.irap.omp.eu/epallier/pyros.git |
252 | 35 | Etienne Pallier | |
253 | 35 | Etienne Pallier | Directory: |
254 | 35 | Etienne Pallier | par défaut, il propose : /Users/epallier/git/pyros |
255 | 35 | Etienne Pallier | mais on peut le mettre ailleurs (c'est ce que j'ai fait) |
256 | 35 | Etienne Pallier | |
257 | 35 | Etienne Pallier | initial branch: master |
258 | 35 | Etienne Pallier | remote name: origin |
259 | 35 | Etienne Pallier | |
260 | 35 | Etienne Pallier | Import as general project |
261 | 35 | Etienne Pallier | |
262 | 35 | Etienne Pallier | Project name: PYROS |
263 | 35 | Etienne Pallier | |
264 | 35 | Etienne Pallier | |
265 | 35 | Etienne Pallier | 3) Configure the project |
266 | 35 | Etienne Pallier | |
267 | 35 | Etienne Pallier | The project is created. Now, you have to set it as a «PyDev » and a « Django » project. |
268 | 35 | Etienne Pallier | |
269 | 35 | Etienne Pallier | clic droit sur le projet / PyDev / set as a PyDev project |
270 | 35 | Etienne Pallier | |
271 | 35 | Etienne Pallier | clic droit sur le projet / PyDev / set as a Django project |
272 | 35 | Etienne Pallier | |
273 | 35 | Etienne Pallier | clic droit sur le projet : on doit maintenant avoir un sous-menu Django |
274 | 35 | Etienne Pallier | |
275 | 35 | Etienne Pallier | clic droit sur le dossier src / PyDev / set as source folder (add to PYTHONPATH) |
276 | 35 | Etienne Pallier | |
277 | 35 | Etienne Pallier | clic droit sur projet / Properties / Pydev-Django : |
278 | 35 | Etienne Pallier | - Django manage.py : src/manage.py |
279 | 35 | Etienne Pallier | - Django settings module : pyros.settings |
280 | 35 | Etienne Pallier | |
281 | 35 | Etienne Pallier | |
282 | 35 | Etienne Pallier | 4) Set Code style |
283 | 35 | Etienne Pallier | |
284 | 35 | Etienne Pallier | Window/Preferences : Pydev / Editor |
285 | 35 | Etienne Pallier | - Auto Imports : uncheck « Do auto import » |
286 | 35 | Etienne Pallier | - Code style: |
287 | 35 | Etienne Pallier | - Locals … : camelCase |
288 | 35 | Etienne Pallier | - Methods : camelCase() with first lower |
289 | 35 | Etienne Pallier | - Code style / Code Formatter: activer « use autopep8.py for code formatting » |
290 | 35 | Etienne Pallier | - Tabs : Tab length : 4 |
291 | 35 | Etienne Pallier | |
292 | 67 | Etienne Pallier | 5) Now, once the Python3 virtual environment is installed (see above), |
293 | 66 | Etienne Pallier | set it in Eclipse as the project interpreter: |
294 | 66 | Etienne Pallier | |
295 | 68 | Etienne Pallier | Right clic on the project / Properties / PyDev - Interpreter/Grammar : |
296 | 66 | Etienne Pallier | Grammar version : 3 |
297 | 66 | Etienne Pallier | |
298 | 66 | Etienne Pallier | Interpreter : click on « click here to configure an interpreter not listed » |
299 | 66 | Etienne Pallier | |
300 | 66 | Etienne Pallier | click on « New... » : |
301 | 66 | Etienne Pallier | - Interpreter name : venv_py35_pyros |
302 | 66 | Etienne Pallier | - Interpreter executable : click on « Browse » |
303 | 66 | Etienne Pallier | Select your virtualenv python35 executable (private/venv_py35_pyros/bin/python3.5) |
304 | 66 | Etienne Pallier | click OK |
305 | 66 | Etienne Pallier | |
306 | 66 | Etienne Pallier | *Now, a last thing to do so that Pydev finds Django:* |
307 | 66 | Etienne Pallier | |
308 | 66 | Etienne Pallier | In the Python interpreters list, select your virtual env (venv_py35_pyros) |
309 | 66 | Etienne Pallier | |
310 | 66 | Etienne Pallier | Click on the tab "Libraries" |
311 | 66 | Etienne Pallier | |
312 | 66 | Etienne Pallier | clic on 'New folder', then select your virtualenv's lib/python3.5/site-packages folder |
313 | 66 | Etienne Pallier | |
314 | 66 | Etienne Pallier | OK |
315 | 66 | Etienne Pallier | |
316 | 66 | Etienne Pallier | Interpreter: select now venv_py35_pyros from the list |
317 | 66 | Etienne Pallier | |
318 | 66 | Etienne Pallier | OK |
319 | 62 | Etienne Pallier | |
320 | 78 | Etienne Pallier | 6) Test |
321 | 1 | Etienne Pallier | |
322 | 78 | Etienne Pallier | * Right-clic on the project / Django / Run Django tests |
323 | 78 | Etienne Pallier | |
324 | 78 | Etienne Pallier | * Right-clic on the project / Django / Custom command / ... |
325 | 78 | Etienne Pallier | |
326 | 78 | Etienne Pallier | |
327 | 78 | Etienne Pallier | 7) Run |
328 | 70 | Etienne Pallier | |
329 | 70 | Etienne Pallier | Right clic on project -> Django/Custom command/runserver |
330 | 70 | Etienne Pallier | |
331 | 70 | Etienne Pallier | Error on Ubuntu : |
332 | 70 | Etienne Pallier | |
333 | 70 | Etienne Pallier | <pre> |
334 | 70 | Etienne Pallier | |
335 | 70 | Etienne Pallier | Traceback (most recent call last): |
336 | 70 | Etienne Pallier | File "/home/carens_p/git/pyros/src/manage.py", line 8, in <module> |
337 | 70 | Etienne Pallier | from django.core.management import execute_from_command_line |
338 | 70 | Etienne Pallier | ImportError: No module named 'django' |
339 | 70 | Etienne Pallier | |
340 | 70 | Etienne Pallier | </pre> |
341 | 70 | Etienne Pallier | |
342 | 70 | Etienne Pallier | Project -> Properties -> Pydev interpreter -> Clic here to configure an interpreter not listed |
343 | 70 | Etienne Pallier | |
344 | 70 | Etienne Pallier | select venv_py35_pyros |
345 | 70 | Etienne Pallier | |
346 | 70 | Etienne Pallier | In Libraries, clic on 'New folder', then select your virtualenv's lib/python3.5/site-packages folder. |
347 | 70 | Etienne Pallier | |
348 | 70 | Etienne Pallier | OK -> re-select venv_py35_pyros in 'Interpreter' dropdown menu |
349 | 70 | Etienne Pallier | |
350 | 70 | Etienne Pallier | Then right clic on project -> Django/Custom command/runserver |
351 | 70 | Etienne Pallier | |
352 | 70 | Etienne Pallier | check http://localhost:8000/ |
353 | 70 | Etienne Pallier | |
354 | 70 | Etienne Pallier | |
355 | 62 | Etienne Pallier | --- |
356 | 62 | Etienne Pallier | |
357 | 62 | Etienne Pallier | --- |
358 | 62 | Etienne Pallier | |
359 | 81 | Etienne Pallier | h2. %{margin-left:0px; font-weight:bold; font-size:25px; display:block; color:red;}MANUAL INSTALLATION OF PYTHON PACKAGES ONE BY ONE% |
360 | 81 | Etienne Pallier | |
361 | 172 | Etienne Pallier | *Follow these steps only if the previous guided and nearly automatic installation did not work for you* |
362 | 100 | Etienne Pallier | |
363 | 172 | Etienne Pallier | |
364 | 174 | Etienne Pallier | h3. (Only if using Mysql) Create the database "pyros" and the pyros user |
365 | 174 | Etienne Pallier | |
366 | 174 | Etienne Pallier | Only if you are using Mysql, you need to create an empty database "pyros" |
367 | 174 | Etienne Pallier | (which will be filled automatically by django) |
368 | 174 | Etienne Pallier | |
369 | 174 | Etienne Pallier | <pre> |
370 | 174 | Etienne Pallier | $ mysql -u root -p |
371 | 174 | Etienne Pallier | (enter your root password) |
372 | 174 | Etienne Pallier | |
373 | 174 | Etienne Pallier | $ mysql> create database if not exists pyros; |
374 | 174 | Etienne Pallier | </pre> |
375 | 174 | Etienne Pallier | |
376 | 174 | Etienne Pallier | The user creation depends on your MySQL version : |
377 | 174 | Etienne Pallier | |
378 | 174 | Etienne Pallier | * 5.7 and above : |
379 | 174 | Etienne Pallier | <pre> |
380 | 174 | Etienne Pallier | $ mysql> DROP USER IF EXISTS pyros; |
381 | 174 | Etienne Pallier | $ mysql> CREATE USER 'pyros' IDENTIFIED BY 'DjangoPyros'; |
382 | 174 | Etienne Pallier | $ mysql> GRANT ALL PRIVILEGES ON pyros.* TO pyros; |
383 | 174 | Etienne Pallier | </pre> |
384 | 174 | Etienne Pallier | |
385 | 174 | Etienne Pallier | * under 5.7 : |
386 | 174 | Etienne Pallier | <pre> |
387 | 174 | Etienne Pallier | $ mysql> GRANT USAGE ON *.* TO 'pyros'; |
388 | 174 | Etienne Pallier | $ mysql> DROP USER 'pyros'; |
389 | 174 | Etienne Pallier | $ mysql> CREATE USER 'pyros' IDENTIFIED BY 'DjangoPyros'; |
390 | 174 | Etienne Pallier | $ mysql> GRANT ALL PRIVILEGES ON pyros.* TO pyros; |
391 | 174 | Etienne Pallier | </pre> |
392 | 174 | Etienne Pallier | |
393 | 174 | Etienne Pallier | If none of these solution work, check on the internet to create a user named pyros with the password DjangoPyros. |
394 | 174 | Etienne Pallier | |
395 | 100 | Etienne Pallier | h3. Create a Python3 virtual environment dedicated to the project (inside the project folder) |
396 | 100 | Etienne Pallier | |
397 | 100 | Etienne Pallier | <pre> |
398 | 100 | Etienne Pallier | |
399 | 100 | Etienne Pallier | $ mkdir private/ |
400 | 100 | Etienne Pallier | |
401 | 100 | Etienne Pallier | $ cd private/ |
402 | 100 | Etienne Pallier | |
403 | 100 | Etienne Pallier | $ which python3.5 ("where python" for windows) |
404 | 100 | Etienne Pallier | /opt/local/bin/python3.5 |
405 | 100 | Etienne Pallier | |
406 | 100 | Etienne Pallier | $ virtualenv venv_py35_pyros -p /opt/local/bin/python3.5 |
407 | 100 | Etienne Pallier | => creates a venv_py35_pyros/ folder inside PYROS/private/ |
408 | 100 | Etienne Pallier | |
409 | 100 | Etienne Pallier | </pre> |
410 | 100 | Etienne Pallier | |
411 | 100 | Etienne Pallier | |
412 | 100 | Etienne Pallier | --- |
413 | 100 | Etienne Pallier | |
414 | 100 | Etienne Pallier | h3. Activate the python virtual environment (from inside the project) |
415 | 100 | Etienne Pallier | |
416 | 100 | Etienne Pallier | <pre> |
417 | 100 | Etienne Pallier | |
418 | 100 | Etienne Pallier | $ pwd |
419 | 100 | Etienne Pallier | .../PYROS/private |
420 | 100 | Etienne Pallier | |
421 | 100 | Etienne Pallier | $ source ./venv_py35_pyros/bin/activate (venv_py35_pyros/Scripts/activate on Windows) |
422 | 100 | Etienne Pallier | |
423 | 100 | Etienne Pallier | </pre> |
424 | 100 | Etienne Pallier | |
425 | 100 | Etienne Pallier | --- |
426 | 100 | Etienne Pallier | |
427 | 100 | Etienne Pallier | h3. Install needed python packages |
428 | 100 | Etienne Pallier | |
429 | 81 | Etienne Pallier | Check that the virtual environment is activated |
430 | 81 | Etienne Pallier | <pre> |
431 | 81 | Etienne Pallier | $ python -V |
432 | 81 | Etienne Pallier | Python 3... |
433 | 81 | Etienne Pallier | |
434 | 81 | Etienne Pallier | $ which pip |
435 | 81 | Etienne Pallier | .../PYROS/venv_py35_pyros/bin/pip |
436 | 81 | Etienne Pallier | </pre> |
437 | 81 | Etienne Pallier | |
438 | 81 | Etienne Pallier | |
439 | 81 | Etienne Pallier | Upgrade pip to last version available: |
440 | 81 | Etienne Pallier | <pre> |
441 | 81 | Etienne Pallier | $ pip install --upgrade pip |
442 | 81 | Etienne Pallier | Collecting pip |
443 | 81 | Etienne Pallier | Downloading pip-8.1.1-py2.py3-none-any.whl (1.2MB) |
444 | 81 | Etienne Pallier | Installing collected packages: pip |
445 | 81 | Etienne Pallier | Found existing installation: pip 7.1.2 |
446 | 81 | Etienne Pallier | Uninstalling pip-7.1.2: |
447 | 81 | Etienne Pallier | Successfully uninstalled pip-7.1.2 |
448 | 81 | Etienne Pallier | Successfully installed pip-8.1.1 |
449 | 81 | Etienne Pallier | |
450 | 81 | Etienne Pallier | Upgrade wheel to last version available: |
451 | 81 | Etienne Pallier | $ pip install --upgrade wheel |
452 | 81 | Etienne Pallier | Collecting wheel |
453 | 81 | Etienne Pallier | Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB) |
454 | 81 | Etienne Pallier | Installing collected packages: wheel |
455 | 81 | Etienne Pallier | Found existing installation: wheel 0.24.0 |
456 | 81 | Etienne Pallier | Uninstalling wheel-0.24.0: |
457 | 81 | Etienne Pallier | Successfully uninstalled wheel-0.24.0 |
458 | 81 | Etienne Pallier | Successfully installed wheel-0.29.0 |
459 | 81 | Etienne Pallier | |
460 | 81 | Etienne Pallier | </pre> |
461 | 81 | Etienne Pallier | |
462 | 81 | Etienne Pallier | Go into the install/ folder: |
463 | 81 | Etienne Pallier | <pre> |
464 | 81 | Etienne Pallier | $ cd .../PYROS/install/ |
465 | 81 | Etienne Pallier | </pre> |
466 | 81 | Etienne Pallier | |
467 | 84 | Etienne Pallier | Install all the needed python packages at once: |
468 | 85 | Etienne Pallier | <pre> |
469 | 1 | Etienne Pallier | $ pip install -r REQUIREMENTS.txt |
470 | 85 | Etienne Pallier | </pre> |
471 | 84 | Etienne Pallier | |
472 | 84 | Etienne Pallier | If something goes wrong, install them one by one: |
473 | 62 | Etienne Pallier | |
474 | 62 | Etienne Pallier | * *Install Django* : |
475 | 62 | Etienne Pallier | <pre> |
476 | 62 | Etienne Pallier | $ pip install django |
477 | 62 | Etienne Pallier | Collecting django |
478 | 62 | Etienne Pallier | Downloading Django-1.9.4-py2.py3-none-any.whl (6.6MB) |
479 | 62 | Etienne Pallier | Installing collected packages: django |
480 | 62 | Etienne Pallier | Successfully installed django-1.9.4 |
481 | 62 | Etienne Pallier | |
482 | 62 | Etienne Pallier | $ pip install django-admin-tools |
483 | 62 | Etienne Pallier | Collecting django-admin-tools |
484 | 62 | Etienne Pallier | Downloading django_admin_tools-0.7.2-py2.py3-none-any.whl (289kB) |
485 | 62 | Etienne Pallier | Installing collected packages: django-admin-tools |
486 | 62 | Etienne Pallier | Successfully installed django-admin-tools-0.7.2 |
487 | 62 | Etienne Pallier | |
488 | 62 | Etienne Pallier | $ pip install django-debug-toolbar |
489 | 62 | Etienne Pallier | Collecting django-debug-toolbar |
490 | 62 | Etienne Pallier | Downloading django_debug_toolbar-1.4-py2.py3-none-any.whl (212kB) |
491 | 62 | Etienne Pallier | Requirement already satisfied (use --upgrade to upgrade): Django>=1.7 in ./venv_py35_pyros/lib/python3.5/site-packages (from django-debug-toolbar) |
492 | 62 | Etienne Pallier | Collecting sqlparse (from django-debug-toolbar) |
493 | 62 | Etienne Pallier | Downloading sqlparse-0.1.19.tar.gz (58kB) |
494 | 62 | Etienne Pallier | Building wheels for collected packages: sqlparse |
495 | 62 | Etienne Pallier | Running setup.py bdist_wheel for sqlparse ... done |
496 | 62 | Etienne Pallier | Stored in directory: /Users/epallier/Library/Caches/pip/wheels/7b/d4/72/6011bb100dd5fc213164e4bbee13d4e03261dd54ce6a5de6b8 |
497 | 62 | Etienne Pallier | Successfully built sqlparse |
498 | 62 | Etienne Pallier | Installing collected packages: sqlparse, django-debug-toolbar |
499 | 62 | Etienne Pallier | Successfully installed django-debug-toolbar-1.4 sqlparse-0.1.19 |
500 | 62 | Etienne Pallier | |
501 | 62 | Etienne Pallier | $ pip install django-extensions |
502 | 62 | Etienne Pallier | Collecting django-extensions |
503 | 62 | Etienne Pallier | Downloading django_extensions-1.6.1-py2.py3-none-any.whl (202kB) |
504 | 62 | Etienne Pallier | Collecting six>=1.2 (from django-extensions) |
505 | 62 | Etienne Pallier | Downloading six-1.10.0-py2.py3-none-any.whl |
506 | 62 | Etienne Pallier | Installing collected packages: six, django-extensions |
507 | 62 | Etienne Pallier | Successfully installed django-extensions-1.6.1 six-1.10.0 |
508 | 62 | Etienne Pallier | |
509 | 62 | Etienne Pallier | $ pip install django-suit |
510 | 62 | Etienne Pallier | Collecting django-suit |
511 | 62 | Etienne Pallier | Downloading django-suit-0.2.18.tar.gz (587kB) |
512 | 62 | Etienne Pallier | Building wheels for collected packages: django-suit |
513 | 62 | Etienne Pallier | Running setup.py bdist_wheel for django-suit ... done |
514 | 62 | Etienne Pallier | Stored in directory: /Users/epallier/Library/Caches/pip/wheels/12/8b/9a/e02ab0ad9229881638aa040d47d77c8f562999533811927d41 |
515 | 62 | Etienne Pallier | Successfully built django-suit |
516 | 62 | Etienne Pallier | Installing collected packages: django-suit |
517 | 62 | Etienne Pallier | Successfully installed django-suit-0.2.18 |
518 | 62 | Etienne Pallier | |
519 | 62 | Etienne Pallier | </pre> |
520 | 62 | Etienne Pallier | |
521 | 62 | Etienne Pallier | * *Install the django boostrap css package* : |
522 | 62 | Etienne Pallier | <pre> |
523 | 62 | Etienne Pallier | $ pip install django-bootstrap3 |
524 | 62 | Etienne Pallier | </pre> |
525 | 62 | Etienne Pallier | (==> 'bootstrap3' is then to be added as an application in settings.py -> INSTALLED_APPS) |
526 | 62 | Etienne Pallier | |
527 | 62 | Etienne Pallier | * *Install the web application server gunicorn (will be used in production instead of the dev django web server)* : |
528 | 62 | Etienne Pallier | <pre> |
529 | 62 | Etienne Pallier | $ pip install gunicorn |
530 | 62 | Etienne Pallier | Collecting gunicorn |
531 | 62 | Etienne Pallier | Downloading gunicorn-19.4.5-py2.py3-none-any.whl (112kB) |
532 | 62 | Etienne Pallier | Installing collected packages: gunicorn |
533 | 62 | Etienne Pallier | Successfully installed gunicorn-19.4.5 |
534 | 62 | Etienne Pallier | </pre> |
535 | 62 | Etienne Pallier | |
536 | 62 | Etienne Pallier | * *Install the python mysql client* (not needed if you want to use sqlite): |
537 | 62 | Etienne Pallier | <pre> |
538 | 62 | Etienne Pallier | $ pip install mysqlclient |
539 | 62 | Etienne Pallier | ... |
540 | 62 | Etienne Pallier | </pre> |
541 | 62 | Etienne Pallier | |
542 | 146 | Etienne Pallier | * => If issue under Mac OS X: |
543 | 62 | Etienne Pallier | <pre> |
544 | 62 | Etienne Pallier | $ pip install mysqlclient |
545 | 62 | Etienne Pallier | Collecting mysqlclient |
546 | 62 | Etienne Pallier | Downloading mysqlclient-1.3.7.tar.gz (79kB) |
547 | 62 | Etienne Pallier | Building wheels for collected packages: mysqlclient |
548 | 62 | Etienne Pallier | Running setup.py bdist_wheel for mysqlclient ... error |
549 | 62 | Etienne Pallier | … |
550 | 62 | Etienne Pallier | ---------------------------------------- |
551 | 62 | Etienne Pallier | Failed building wheel for mysqlclient |
552 | 62 | Etienne Pallier | Running setup.py clean for mysqlclient |
553 | 62 | Etienne Pallier | Failed to build mysqlclient |
554 | 62 | Etienne Pallier | Installing collected packages: mysqlclient |
555 | 62 | Etienne Pallier | Running setup.py install for mysqlclient ... done |
556 | 62 | Etienne Pallier | Successfully installed mysqlclient-1.3.7 |
557 | 62 | Etienne Pallier | |
558 | 62 | Etienne Pallier | BOUH !!! |
559 | 1 | Etienne Pallier | |
560 | 152 | Etienne Pallier | => Need to upgrade wheel: |
561 | 146 | Etienne Pallier | |
562 | 62 | Etienne Pallier | $ pip install --upgrade wheel |
563 | 62 | Etienne Pallier | Collecting wheel |
564 | 62 | Etienne Pallier | Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB) |
565 | 62 | Etienne Pallier | Installing collected packages: wheel |
566 | 62 | Etienne Pallier | Found existing installation: wheel 0.24.0 |
567 | 62 | Etienne Pallier | Uninstalling wheel-0.24.0: |
568 | 62 | Etienne Pallier | Successfully uninstalled wheel-0.24.0 |
569 | 62 | Etienne Pallier | Successfully installed wheel-0.29.0 |
570 | 62 | Etienne Pallier | |
571 | 153 | Etienne Pallier | YES !!! |
572 | 1 | Etienne Pallier | |
573 | 154 | Etienne Pallier | Only if necessary, you can reinstall mysqlclient: |
574 | 153 | Etienne Pallier | $ pip uninstall mysqlclient |
575 | 62 | Etienne Pallier | $ pip install mysqlclient |
576 | 62 | Etienne Pallier | Collecting mysqlclient |
577 | 62 | Etienne Pallier | Using cached mysqlclient-1.3.7.tar.gz |
578 | 62 | Etienne Pallier | Building wheels for collected packages: mysqlclient |
579 | 62 | Etienne Pallier | Running setup.py bdist_wheel for mysqlclient ... done |
580 | 62 | Etienne Pallier | Stored in directory: /Users/epallier/Library/Caches/pip/wheels/9b/06/50/d11418c26cf8f2156b13d4363b5afde8e7e75ebb8540d0228d |
581 | 62 | Etienne Pallier | Successfully built mysqlclient |
582 | 62 | Etienne Pallier | Installing collected packages: mysqlclient |
583 | 62 | Etienne Pallier | Successfully installed mysqlclient-1.3.7 |
584 | 62 | Etienne Pallier | |
585 | 1 | Etienne Pallier | </pre> |
586 | 62 | Etienne Pallier | |
587 | 146 | Etienne Pallier | * => If issue under Windows |
588 | 62 | Etienne Pallier | <pre> |
589 | 62 | Etienne Pallier | Same message as the issue for Mac. |
590 | 146 | Etienne Pallier | |
591 | 152 | Etienne Pallier | => Need to upgrade wheel: |
592 | 62 | Etienne Pallier | |
593 | 62 | Etienne Pallier | Go to http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient to download the newest mysqlclient wheel |
594 | 62 | Etienne Pallier | |
595 | 62 | Etienne Pallier | $ pip install path\to\mysqlclient\wheel |
596 | 62 | Etienne Pallier | |
597 | 154 | Etienne Pallier | (No need to redo "pip install mysqlclient") |
598 | 62 | Etienne Pallier | </pre> |
599 | 163 | Paul Carensac | |
600 | 163 | Paul Carensac | * *Install the julian day converter* : |
601 | 163 | Paul Carensac | <pre> |
602 | 163 | Paul Carensac | $ pip install jdcal |
603 | 163 | Paul Carensac | </pre> |