Notas de Luis

¡Esta es una revisión vieja del documento!


## Troubleshooting

Here are some troubleshooting steps… For when things do not go right there are a few things you can do to troubleshoot.

It is very important to check carefully for any spelling errors in all the files you edited.

Check systemd.

```bash $ sudo systemctl status my_flask_app.service $ sudo journalctl -xe ```

Restart the Gunicorn systemd service.

```bash $ sudo systemctl restart my_flask_app.service $ sudo systemctl daemon-reload ```

Add logging to Gunicorn by changing the ExecStart line. Add `–error-logfile error.log` and `–log-level debug` to the end of the line.

Change the ExecStart line:

``` ExecStart=/var/www/my_flask_app/.venv/bin/gunicorn –workers 3 –bind unix:/var/www/my_flask_app/myproject.sock wsgi:app ```

To this:

``` ExecStart=/var/www/my_flask_app/.venv/bin/gunicorn –workers 3 –bind unix:/var/www/my_flask_app/myproject.sock wsgi:app –error-logfile error.log –log-level debug ```

Check the Nginx log files.

```bash $ less /var/log/nginx/error.log $ less /var/log/nginx/my_flask_app.error.log ```

Comprobar si `nginx` está escuchando en el puerto 80.

``` $ ss -lnt | grep 80 LISTEN 0 511 0.0.0.0:80 0.0.0.0:* LISTEN 0 511 [::]:80 [::]:* ```

Usa `curl` para comprobar que da una respuesta 200 OK.

```bash $ curl -I http://my_flask_app ```

Salida esperada (aproximada):

``` HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Content-Length: 30 Server: gunicorn/21.2.0 Date: Wed, 03 Feb 2021 15:18:55 GMT ```

computing/web/flask_app_3.1768333206.txt.gz · Última modificación: por alfabeto