[Python] Trying to deploy Django web app on PythonAnywhere, "no python application found"

Discussão em 'Python' iniciado por Stack, Maio 12, 2025.

  1. Stack

    Stack Membro Participativo

    I have a Django web app (Python 3.11) that runs on Azure, and I'm trying to migrate it to PythonAnywhere.

    I've followed the setup instructions. The web page itself says "Internal Server Error". The error log is empty. The server log has the following:

    --- no python application found, check your startup logs for errors ---


    as well as a most peculiar 'import math' error (see below) that may be relevant. (Starting python in my virtual environment, I'm unable to import anything there either, so possibly a PYTHONPATH or other env problem?)

    Where are these startup logs?

    I assume something is just pointing to the wrong place, I just need the information to work out what.

    The server log in more detail:

    2025-05-12 11:23:16 SIGINT/SIGTERM received...killing workers...
    2025-05-12 11:23:17 worker 1 buried after 1 seconds
    2025-05-12 11:23:17 goodbye to uWSGI.
    2025-05-12 11:23:17 VACUUM: unix socket /var/sockets/avoca999.eu.pythonanywhere.com/socket removed.
    2025-05-12 11:23:23 *** Starting uWSGI 2.0.28 (64bit) on [Mon May 12 11:23:22 2025] ***
    2025-05-12 11:23:23 compiled with version: 11.4.0 on 16 January 2025 20:41:13
    2025-05-12 11:23:23 os: Linux-6.5.0-1022-aws #22~22.04.1-Ubuntu SMP Fri Jun 14 16:31:00 UTC 2024
    2025-05-12 11:23:23 nodename: blue-euweb3
    2025-05-12 11:23:23 machine: x86_64
    2025-05-12 11:23:23 clock source: unix
    2025-05-12 11:23:23 pcre jit disabled
    2025-05-12 11:23:23 detected number of CPU cores: 4
    2025-05-12 11:23:23 current working directory: /home/avoca999
    2025-05-12 11:23:23 detected binary path: /usr/local/bin/uwsgi
    2025-05-12 11:23:23 *** dumping internal routing table ***
    2025-05-12 11:23:23 [rule: 0] subject: path_info regexp: \.svgz$ action: addheader:Content-Encoding:gzip
    2025-05-12 11:23:23 *** end of the internal routing table ***
    2025-05-12 11:23:23 chdir() to /home/avoca999/
    2025-05-12 11:23:23 your processes number limit is 256
    2025-05-12 11:23:23 your memory page size is 4096 bytes
    2025-05-12 11:23:23 detected max file descriptor number: 123456
    2025-05-12 11:23:23 building mime-types dictionary from file /etc/mime.types...
    2025-05-12 11:23:23 1516 entry found
    2025-05-12 11:23:23 lock engine: pthread robust mutexes
    2025-05-12 11:23:23 thunder lock: disabled (you can enable it with --thunder-lock)
    2025-05-12 11:23:23 uwsgi socket 0 bound to UNIX address /var/sockets/avoca999.eu.pythonanywhere.com/socket fd 3
    2025-05-12 11:23:23 Python version: 3.11.11 (main, Jan 16 2025, 11:48:26) [GCC 11.4.0]
    2025-05-12 11:23:23 PEP 405 virtualenv detected: /home/avoca999/.virtualenvs/cdbvenv
    2025-05-12 11:23:23 Set PythonHome to /home/avoca999/.virtualenvs/cdbvenv
    2025-05-12 11:23:23 Python main interpreter initialized at 0x758a286dd698
    2025-05-12 11:23:23 python threads support enabled
    2025-05-12 11:23:23 your server socket listen backlog is limited to 100 connections
    2025-05-12 11:23:23 your mercy for graceful operations on workers is 60 seconds
    2025-05-12 11:23:23 setting request body buffering size to 65536 bytes
    2025-05-12 11:23:23 mapped 334256 bytes (326 KB) for 1 cores
    2025-05-12 11:23:23 *** Operational MODE: single process ***
    2025-05-12 11:23:23 initialized 38 metrics
    2025-05-12 11:23:23 Traceback (most recent call last):
    2025-05-12 11:23:23 File "/bin/user_wsgi_wrapper.py", line 30, in <module>
    2025-05-12 11:23:23 from datetime import datetime
    2025-05-12 11:23:23 File "/usr/local/lib/python3.11/datetime.py", line 12, in <module>
    2025-05-12 11:23:23 import math as _math
    2025-05-12 11:23:23 ModuleNotFoundError: No module named 'math'
    2025-05-12 11:23:23 unable to load app 0 (mountpoint='') (callable not found or import error)
    2025-05-12 11:23:23 *** no app loaded. going in full dynamic mode ***
    2025-05-12 11:23:23 *** uWSGI is running in multiple interpreter mode ***
    2025-05-12 11:23:23 gracefully (RE)spawned uWSGI master process (pid: 1)
    2025-05-12 11:23:23 spawned uWSGI worker 1 (pid: 2, cores: 1)
    2025-05-12 11:23:23 spawned 2 offload threads for uWSGI worker 1
    2025-05-12 11:23:23 metrics collector thread started
    2025-05-12 11:23:26 --- no python application found, check your startup logs for errors ---
    2025-05-12 11:23:26 announcing my loyalty to the Emperor...
    2025-05-12 11:23:36 --- no python application found, check your startup logs for errors ---
    2025-05-12 11:23:36 --- no python application found, check your startup logs for errors ---

    Continue reading...

Compartilhe esta Página