Forums

Error code: 502-backend

I have the following error when I open my website: Something went wrong :-( Something went wrong while trying to load this site; please try again later. Debugging tips If this is your site, and you just reloaded it, then the problem might simply be that it hasn't loaded up yet. Try refreshing this page and see if this message disappears. If you keep getting this message, you should check your site's server and error logs for any messages. Error code: 502-backend

Everything seems to work normally in my django application. I tried typing python /var/www/jreaigle_pythonanywhere_com_wsgi.py to see if there is an error. But no error comes out.

Update : I get this message when I relaunch my web application :

2022-12-28 22:26:52 !!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!
2022-12-28 22:26:52 no request plugin is loaded, you will not be able to manage requests.
2022-12-28 22:26:52 you may need to install the package for your language of choice, or simply load it with --plugin.
2022-12-28 22:26:52 !!!!!!!!!!! END OF WARNING !!!!!!!!!!

but I have no idea how to fix it. Thanks in advance for the help!

That looks like you may have done something to interfere with the loading of the uwsgi plugin that runs the Python code. Are there any other errors near that message?

I can give you the complete logs, there don't seem to be any other errors :

   2022-12-29 16:19:55 *** Starting uWSGI 2.0.19.1 (64bit) on [Thu Dec 29 16:19:55 2022] ***
2022-12-29 16:19:55 compiled with version: 9.3.0 on 27 May 2021 21:02:35
2022-12-29 16:19:55 os: Linux-5.15.0-1017-aws #21~20.04.1 SMP Tue Aug 16 15:49:47 UTC 2022
2022-12-29 16:19:55 nodename: blue-liveweb4
2022-12-29 16:19:55 machine: x86_64
2022-12-29 16:19:55 clock source: unix
2022-12-29 16:19:55 pcre jit disabled
2022-12-29 16:19:55 detected number of CPU cores: 4
2022-12-29 16:19:55 current working directory: /home/jreaigle
2022-12-29 16:19:55 detected binary path: /usr/local/bin/uwsgi
2022-12-29 16:19:55 *** dumping internal routing table ***
2022-12-29 16:19:55 [rule: 0] subject: path_info regexp: \.svgz$ action: addheader:Content-Encoding:gzip
2022-12-29 16:19:55 *** end of the internal routing table ***
2022-12-29 16:19:55 chdir() to /home/jreaigle/
2022-12-29 16:19:55 your processes number limit is 128
2022-12-29 16:19:55 your memory page size is 4096 bytes
2022-12-29 16:19:55 detected max file descriptor number: 123456
2022-12-29 16:19:55 building mime-types dictionary from file /etc/mime.types...
2022-12-29 16:19:55 567 entry found
2022-12-29 16:19:55 lock engine: pthread robust mutexes
2022-12-29 16:19:55 thunder lock: disabled (you can enable it with --thunder-lock)
2022-12-29 16:19:55 uwsgi socket 0 bound to UNIX address /var/sockets/jreaigle.pythonanywhere.com/socket fd 8
2022-12-29 16:19:55 your server socket listen backlog is limited to 100 connections
2022-12-29 16:19:55 your mercy for graceful operations on workers is 60 seconds
2022-12-29 16:19:55 setting request body buffering size to 65536 bytes
2022-12-29 16:19:55 mapped 334256 bytes (326 KB) for 1 cores
2022-12-29 16:19:55 *** Operational MODE: single process ***
2022-12-29 16:19:55 initialized 38 metrics
2022-12-29 16:19:55 *** no app loaded. going in full dynamic mode ***
2022-12-29 16:19:55 *** uWSGI is running in multiple interpreter mode ***
2022-12-29 16:19:55 !!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!
2022-12-29 16:19:55 no request plugin is loaded, you will not be able to manage requests.
2022-12-29 16:19:55 you may need to install the package for your language of choice, or simply load it with --plugin.
2022-12-29 16:19:55 !!!!!!!!!!! END OF WARNING !!!!!!!!!!
2022-12-29 16:19:55 spawned uWSGI master process (pid: 1)
2022-12-29 16:19:55 spawned uWSGI worker 1 (pid: 7, cores: 1)
2022-12-29 16:19:55 metrics collector thread started
2022-12-29 16:19:55 spawned 2 offload threads for uWSGI worker 1
2022-12-29 16:19:55 -- unavailable modifier requested: 0 --
2022-12-29 16:19:55 -- unavailable modifier requested: 0 --

If you want I can also give you the code of my wsgi file (/var/www/jreaigle_pythonanywhere_com_wsgi.py):

import os
import sys

path = '/home/jreaigle/jre-site/'  
if path not in sys.path:
    sys.path.append(path)

os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

from django.core.wsgi import get_wsgi_application
from django.contrib.staticfiles.handlers import StaticFilesHandler
application = StaticFilesHandler(get_wsgi_application())

Thank you in advance for your help!

It looks like you're trying to use a Python version that is not compatible with the system image that you're using. See https://help.pythonanywhere.com/pages/ChangingSystemImage/ for which Python versions are available on which system images.

oh thank you! I was able to fix the problem with your article!

Excellent, glad we could help!