[Python] uwsgi module not found after Python upgrade

Discussão em 'Python' iniciado por Stack, Setembro 24, 2024.

  1. Stack

    Stack Membro Participativo

    I have a Flask/UWSGI application running on my home server. A recent Ubuntu upgrade deleted Python 3.10 and installed Python 3.12 instead. I've made a new venv and installed the application, but it no longer runs. In the UWSGI log it says:

    ModuleNotFoundError: No module named 'wsgi'


    My application is called sieve and the working directory is /usr/share/sieve. I'm using a ini file, /usr/share/sieve/sieve.ini, which looks like this:

    [uwsgi]
    module = wsgi
    callable = app

    master = true
    processes = 5

    socket = /usr/share/sieve/sieve.sock
    chmod-socket = 660
    vacuum = true

    die-on-term = true
    logto = /usr/share/sieve/sieve.log
    logfile-chown = jon:www-data
    log-date = [%%Y-%%m-%%d %%H:%%M:%%S]


    I've also tried module=sieve.wsgi and module=wsgi:app as suggested elsewhere.

    The application is in a sieve subdirectory and /usr/share/sieve/sieve/wsgi.py looks like this:

    #!/usr/bin/env python
    from run_app import app

    if __name__ == '__main__':
    app.run(debug=True)


    The service definition includes these lines:

    WorkingDirectory=/usr/share/sieve
    Environment="PATH=$PATH:/usr/share/sieve/venv/bin"
    ExecStart=/usr/share/sieve/venv/bin/uwsgi --ini sieve.ini --enable-threads


    I'm not sure what has changed since it was last working, but looking further up the log, this setup worked fine:

    [2024-08-27 21:32:30] - *** Starting uWSGI 2.0.21 (64bit) on [Tue Aug 27 21:32:30 2024] ***
    [2024-08-27 21:32:30] - compiled with version: 11.3.0 on 20 November 2022 14:54:48
    [2024-08-27 21:32:30] - os: Linux-6.8.0-40-generic #40~22.04.3-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 30
    17:30:19 UTC 2


    The current version does not work (with the same site code and config).

    [2024-09-24 20:33:49] - *** Starting uWSGI 2.0.27 (64bit) on [Tue Sep 24 20:33:49 2024] ***
    [2024-09-24 20:33:49] - compiled with version: 13.2.0 on 24 September 2024 18:04:08
    [2024-09-24 20:33:49] - os: Linux-6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024


    Why has my application stopped working and what to I need to do to make UWSGI find the module again?

    Continue reading...

Compartilhe esta Página