|
97 | 97 |
|
98 | 98 | </details>
|
99 | 99 | 1. <details>
|
100 |
| - <summary>Back on the devapp01 webserver. Attempt to start the web application by:</br>Navigate to the directory /opt/caleston-code/mercuryProject</br>Next, run the command python3 manage.py runserver 0.0.0.0:8000</summary> |
| 100 | + <summary>Back on the devapp01 webserver. Attempt to start the web application by:</br>Navigate to the directory /opt/caleston-code/mercuryProject</br>Next, run the command Python3 manage.py runserver 0.0.0.0:8000</summary> |
101 | 101 |
|
102 | 102 | At this point you are still logged into `devdb01`, so first return to Bob's laptop
|
103 | 103 |
|
|
111 | 111 | ssh devapp01
|
112 | 112 |
|
113 | 113 | cd /opt/caleston-code/mercuryProject
|
114 |
| - python3 manage.py runserver 0.0.0.0:8000 |
| 114 | + Python3 manage.py runserver 0.0.0.0:8000 |
115 | 115 | ```
|
116 | 116 |
|
117 | 117 | Note it dumps a stack trace on the screen, i.e. it crashed! Thus the answer is `No`.
|
|
164 | 164 |
|
165 | 165 | ```bash
|
166 | 166 | source ../venv/bin/activate
|
167 |
| - python3 manage.py migrate |
| 167 | + Python3 manage.py migrate |
168 | 168 | ```
|
169 | 169 |
|
170 | 170 | Start the app again so the question will vaildate.
|
171 | 171 |
|
172 | 172 | **What is this venv stuff?**
|
173 | 173 |
|
174 |
| - If you're considering learning Python (highly recommended as it is required in most DevOps jobs), this means Virtual ENVironment. It allows you to install python packages on a project-by-project basis, thus not polluting the main Python installation. |
| 174 | + If you're considering learning Python (highly recommended as it is required in many DevOps jobs), this means Virtual ENVironment. It allows you to install Python packages on a project-by-project basis, thus not polluting the main Python installation. This is especially useful on your development environment where you may have multiple Python projects all with different package requirements. |
175 | 175 |
|
176 | 176 | </details>
|
177 | 177 | 1. <details>
|
178 | 178 | <summary>Well done! Now, for the final task before the client presentation.</summary>
|
179 | 179 |
|
180 |
| - Here we have to create a [systemd unit file](https://kodekloud.com/topic/creating-a-systemd-service/) to make the python app be runnable as a service. |
| 180 | + Here we have to create a [systemd unit file](https://kodekloud.com/topic/creating-a-systemd-service/) to make the Python app be runnable as a service. |
181 | 181 |
|
182 | 182 | First quit the running webapp by pressing `CTRL-C`
|
183 | 183 |
|
184 |
| - Note that in unit files, the process to execute (in this case `python3`) we must use its fully qualified path, as `systemd` does not have a search path. Get this like this |
| 184 | + Note that in unit files, the process to execute (in this case `Python3`) we must use its fully qualified path, as `systemd` does not have a search path. Get this like this |
185 | 185 |
|
186 | 186 | ```bash
|
187 |
| - which python3 |
| 187 | + which Python3 |
188 | 188 | ```
|
189 | 189 |
|
190 | 190 | Now create the unit file
|
|
200 | 200 | Description=Project Mercury Web Application
|
201 | 201 |
|
202 | 202 | [Service]
|
203 |
| - ExecStart=/usr/bin/python3 manage.py runserver 0.0.0.0:8000 |
| 203 | + ExecStart=/usr/bin/Python3 manage.py runserver 0.0.0.0:8000 |
204 | 204 | Restart=on-failure
|
205 | 205 | WorkingDirectory=/opt/caleston-code/mercuryProject/
|
206 | 206 | User=mercury
|
|
0 commit comments