Forums

Django Admin Error code: 502-backend

I moved a website from a different hosting to pythonanywhere, everything seems to be working fine except the admin panel. I'm getting 502-backend error, and in the server log, I'm getting the following response:

2020-03-03 04:51:39 !!! uWSGI process 27 got Segmentation Fault !!! 
2020-03-03 04:51:39 *** backtrace of 27 ***#012site site.pythonanywhere.com uWSGI worker 2(uwsgi_backtrace+0x2c) [0x46529c]#012site  site.pythonanywhere.com uWSGI worker 2(uwsgi_segfault+0x21) 
[0x465661]#012/lib/x86_64-linux-gnu/libc.so.6(+0x354b0) 
[0x7f6c359744b0]#012/usr/lib/libpython3.7m.so.1.0(+0xe7bbf) 
[0x7f6c3245bbbf]#012/usr/lib/libpython3.7m.so.1.0(+0x13c441) 
[0x7f6c324b0441]#012/usr/lib/libpython3.7m.so.1.0(+0xf8283) 
[0x7f6c3246c283]#012/usr/lib/libpython3.7m.so.1.0(_PyObject_FastCallKeywords+0x104) 
[0x7f6c3240e024]#012/usr/lib/libpython3.7m.so.1.0(_PyEval_EvalFrameDefault+0x32aa) 
[0x7f6c323e0d2a]#012/usr/lib/libpython3.7m.so.1.0(+0x688c0) 
[0x7f6c323dc8c0]#012/usr/lib/libpython3.7m.so.1.0(_PyEval_EvalFrameDefault+0x7060) 
[0x7f6c323e4ae0]#012/usr/lib/libpython3.7m.so.1.0(+0x688c0) 
[0x7f6c323dc8c0]#012/usr/lib/libpython3.7m.so.1.0(_PyFunction_FastCallDict+0x2be) 
[0x7f6c3240d8ae]#012/usr/lib/libpython3.7m.so.1.0(_PyObject_Call_Prepend+0xcd) 
[0x7f6c3240ea2d]#012/usr/lib/lib 
2020-03-03 04:51:40 DAMN ! worker 2 (pid: 27) died, killed by signal 11 :( trying respawn ...

What might be the source of this error? Any suggestions welcomed, thanks in advance..

See this. If you are using Django 3, you need to be on our latest system image. Let us know if you want us to switch you over. You would have to rebuild any virtualenvs.

Yes I'm using Django 3, could you please do the switch over. Thanks for the swift help.

No problem. I have updated your system image.

I am having the same problem and I am using Django 3. could you please update my system image

It's done for you. You have to rebuild any virtualenvs. Your web app will run with it after the reload.

Same Issue for me. Can you please update my system image as well?

Sure, we have done that for you. You will have to rebuild any virtualenvs and reload your webapps etc.

I am having tthe same Issue can you please update my system Image as well?

I am having tthe same Issue can you please update my system Image as well?

No problem. I have updated your system image.

Do I need to rebuild the Webapp again?

No, but you might have to rebuild your virtualenv. The best way to find out if you do is just to reload the website using the green button on the "Web" page and see if that makes it start working.

I'm trying to load my web app from github but when using pa_autoconfigure_django.py I get an error

< Running collectstatic >
   \
    ~<:>>>>>>>>>
Traceback (most recent call last):
  File "/home/msychv/msychv.pythonanywhere.com/manage.py", line 10, in main
    from django.core.management import execute_from_command_line
ImportError: No module named 'django'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/home/msychv/msychv.pythonanywhere.com/manage.py", line 21, in <module>
    main()
  File "/home/msychv/msychv.pythonanywhere.com/manage.py", line 16, in main
    ) from exc
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual envir
onment?
Traceback (most recent call last):
  File "/home/msychv/.local/bin/pa_autoconfigure_django.py", line 47, in <module>
    main(arguments['<git-repo-url>'], arguments['--domain'], arguments['--python'], nuke=arguments.get('--nuke'))
  File "/home/msychv/.local/bin/pa_autoconfigure_django.py", line 37, in main
    project.run_collectstatic()
  File "/home/msychv/.local/lib/python3.6/site-packages/pythonanywhere/django_project.py", line 87, in run_collectstatic
    '--noinput',
  File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/msychv/.virtualenvs/msychv.pythonanywhere.com/bin/python', '/home/msychv/msychv.pythonanywhere.com/manage.py', 'co
llectstatic', '--noinput']' returned non-zero exit status 1.

Could it be because of the django version? Locally I use django 3.0.6. And if it is, could you please update my system image? If it's not then what could be the problem?

Does the git project that you're importing have a file called requirements.txt at the top level, and if it does, does that file have a line saying "django" in it?

Yes, the git project has requirements.txt. Well, that error above occurred when the requirements.txt only had the mysqlclient==1.4.6 line because I've already tried with the djano line (which is Django==3.0.6) and got different error:

< Creating virtualenv with Python3.5 >
   \
    ~<:>>>>>>>>>
Removing msychv.pythonanywhere.com...
Running virtualenv with interpreter /usr/bin/python3.5
Already using interpreter /usr/bin/python3.5
Using base prefix '/usr'
New python executable in /home/msychv/.virtualenvs/msychv.pythonanywhere.com/bin/python3.5
Also creating executable in /home/msychv/.virtualenvs/msychv.pythonanywhere.com/bin/python
Installing setuptools, pip, wheel...
done.
Using base prefix '/usr'
virtualenvwrapper.user_scripts creating /home/msychv/.virtualenvs/msychv.pythonanywhere.com/bin/predeactivate
virtualenvwrapper.user_scripts creating /home/msychv/.virtualenvs/msychv.pythonanywhere.com/bin/postdeactivate
virtualenvwrapper.user_scripts creating /home/msychv/.virtualenvs/msychv.pythonanywhere.com/bin/preactivate
virtualenvwrapper.user_scripts creating /home/msychv/.virtualenvs/msychv.pythonanywhere.com/bin/postactivate
virtualenvwrapper.user_scripts creating /home/msychv/.virtualenvs/msychv.pythonanywhere.com/bin/get_env_details
  ______________________________________________________________________
/                                                                        \
| Pip installing -r                                                      |
| /home/msychv/msychv.pythonanywhere.com/requirements.txt (this may take |
| a couple of minutes)                                                   |
\                                                                        /
  ----------------------------------------------------------------------
   \
    ~<:>>>>>>>>>
Looking in links: /usr/share/pip-wheels
Processing ./.cache/pip/wheels/ac/9c/65/82842e0c71ba22cdfaa58860503544932a47b86d055d83c3d2/mysqlclient-1.4.6-cp35-cp35m-linux_x86_64.whl
ERROR: Could not find a version that satisfies the requirement Django==3.0.6 (from -r /home/msychv/msychv.pythonanywhere.com/requirements.txt (line 2)) (from vers
ions: 1.1.3, 1.1.4, 1.2, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.2.6, 1.2.7, 1.3, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.3.6, 1.3.7, 1.4, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1
.4.5, 1.4.6, 1.4.7, 1.4.8, 1.4.9, 1.4.10, 1.4.11, 1.4.12, 1.4.13, 1.4.14, 1.4.15, 1.4.16, 1.4.17, 1.4.18, 1.4.19, 1.4.20, 1.4.21, 1.4.22, 1.5, 1.5.1, 1.5.2, 1.5.3
, 1.5.4, 1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9, 1.5.10, 1.5.11, 1.5.12, 1.6, 1.6.1, 1.6.2, 1.6.3, 1.6.4, 1.6.5, 1.6.6, 1.6.7, 1.6.8, 1.6.9, 1.6.10, 1.6.11, 1.7, 1.7.1
, 1.7.2, 1.7.3, 1.7.4, 1.7.5, 1.7.6, 1.7.7, 1.7.8, 1.7.9, 1.7.10, 1.7.11, 1.8a1, 1.8b1, 1.8b2, 1.8rc1, 1.8, 1.8.1, 1.8.2, 1.8.3, 1.8.4, 1.8.5, 1.8.6, 1.8.7, 1.8.8
, 1.8.9, 1.8.10, 1.8.11, 1.8.12, 1.8.13, 1.8.14, 1.8.15, 1.8.16, 1.8.17, 1.8.18, 1.8.19, 1.9a1, 1.9b1, 1.9rc1, 1.9rc2, 1.9, 1.9.1, 1.9.2, 1.9.3, 1.9.4, 1.9.5, 1.9
.6, 1.9.7, 1.9.8, 1.9.9, 1.9.10, 1.9.11, 1.9.12, 1.9.13, 1.10a1, 1.10b1, 1.10rc1, 1.10, 1.10.1, 1.10.2, 1.10.3, 1.10.4, 1.10.5, 1.10.6, 1.10.7, 1.10.8, 1.11a1, 1.
11b1, 1.11rc1, 1.11, 1.11.1, 1.11.2, 1.11.3, 1.11.4, 1.11.5, 1.11.6, 1.11.7, 1.11.8, 1.11.9, 1.11.10, 1.11.11, 1.11.12, 1.11.13, 1.11.14, 1.11.15, 1.11.16, 1.11.1
7, 1.11.18, 1.11.20, 1.11.21, 1.11.22, 1.11.23, 1.11.24, 1.11.25, 1.11.26, 1.11.27, 1.11.28, 1.11.29, 2.0a1, 2.0b1, 2.0rc1, 2.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5
, 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.0.10, 2.0.12, 2.0.13, 2.1a1, 2.1b1, 2.1rc1, 2.1, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.1.5, 2.1.7, 2.1.8, 2.1.9, 2.1.10, 2.1.11, 2.1.12, 2
.1.13, 2.1.14, 2.1.15, 2.2a1, 2.2b1, 2.2rc1, 2.2, 2.2.1, 2.2.2, 2.2.3, 2.2.4, 2.2.5, 2.2.6, 2.2.7, 2.2.8, 2.2.9, 2.2.10, 2.2.11, 2.2.12)
ERROR: No matching distribution found for Django==3.0.6 (from -r /home/msychv/msychv.pythonanywhere.com/requirements.txt (line 2))
Traceback (most recent call last):
  File "/home/msychv/.local/bin/pa_autoconfigure_django.py", line 47, in <module>
    main(arguments['<git-repo-url>'], arguments['--domain'], arguments['--python'], nuke=arguments.get('--nuke'))
  File "/home/msychv/.local/bin/pa_autoconfigure_django.py", line 31, in main
    project.create_virtualenv(nuke=nuke)
  File "/home/msychv/.local/lib/python3.6/site-packages/pythonanywhere/django_project.py", line 27, in create_virtualenv
    self.virtualenv.pip_install(packages)
  File "/home/msychv/.local/lib/python3.6/site-packages/pythonanywhere/virtualenvs.py", line 30, in pip_install
    subprocess.check_call(commands)
  File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/msychv/.virtualenvs/msychv.pythonanywhere.com/bin/pip', 'install', '-r', '/home/msychv/msychv.pythonanywhere.com/r
equirements.txt']' returned non-zero exit status 1.

I also use python 3.7.3 locally but python 3.5 on pythonanywhere, if it makes any difference (i guess python 3.5 was as default on pythonanywhere and now when I'm trying to change it to 3.7 in Web -> Code field I get This virtualenv seems to have the wrong Python version (3.5 instead of 3.7) in Web -> Virtualenv)

i also have the same issue can you please update it

I think the best solution would be to use the --python=python3.7 option when you run the pa_autoconfigure_django.py command. As it has already done part of the configuration for your site, you should also add --nuke to get rid of the existing partial config.

I'm so sorry for wasting your time but let me see if I get this straight. I ran the pa_autoconfigure_django.py --python==python3.7 --nuke https://github.com/<my-git-progect-repo>.git command but nothing really changed. I still get the same error about the django version as above, except the line

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop sup
port for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python
-2-support

and then goes the main error in red:

ERROR: Could not find a version that satisfies the requirement Django==3.0.6 (from -r /home/msychv/msychv.pythonanywhere.com/requirements.txt (line 2)) (from vers
ions: 1.1.3, 1.1.4, 1.2, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.2.6, 1.2.7, 1.3, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.3.6, 1.3.7, 1.4, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1
.4.5, 1.4.6, 1.4.7, 1.4.8, 1.4.9, 1.4.10, 1.4.11, 1.4.12, 1.4.13, 1.4.14, 1.4.15, 1.4.16, 1.4.17, 1.4.18, 1.4.19, 1.4.20, 1.4.21, 1.4.22, 1.5, 1.5.1, 1.5.2, 1.5.3
, 1.5.4, 1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9, 1.5.10, 1.5.11, 1.5.12, 1.6, 1.6.1, 1.6.2, 1.6.3, 1.6.4, 1.6.5, 1.6.6, 1.6.7, 1.6.8, 1.6.9, 1.6.10, 1.6.11, 1.7, 1.7.1
, 1.7.2, 1.7.3, 1.7.4, 1.7.5, 1.7.6, 1.7.7, 1.7.8, 1.7.9, 1.7.10, 1.7.11, 1.8a1, 1.8b1, 1.8b2, 1.8rc1, 1.8, 1.8.1, 1.8.2, 1.8.3, 1.8.4, 1.8.5, 1.8.6, 1.8.7, 1.8.8
, 1.8.9, 1.8.10, 1.8.11, 1.8.12, 1.8.13, 1.8.14, 1.8.15, 1.8.16, 1.8.17, 1.8.18, 1.8.19, 1.9a1, 1.9b1, 1.9rc1, 1.9rc2, 1.9, 1.9.1, 1.9.2, 1.9.3, 1.9.4, 1.9.5, 1.9
.6, 1.9.7, 1.9.8, 1.9.9, 1.9.10, 1.9.11, 1.9.12, 1.9.13, 1.10a1, 1.10b1, 1.10rc1, 1.10, 1.10.1, 1.10.2, 1.10.3, 1.10.4, 1.10.5, 1.10.6, 1.10.7, 1.10.8, 1.11a1, 1.
11b1, 1.11rc1, 1.11, 1.11.1, 1.11.2, 1.11.3, 1.11.4, 1.11.5, 1.11.6, 1.11.7, 1.11.8, 1.11.9, 1.11.10, 1.11.11, 1.11.12, 1.11.13, 1.11.14, 1.11.15, 1.11.16, 1.11.1
7, 1.11.18, 1.11.20, 1.11.21, 1.11.22, 1.11.23, 1.11.24, 1.11.25, 1.11.26, 1.11.27, 1.11.28, 1.11.29)
ERROR: No matching distribution found for Django==3.0.6 (from -r /home/msychv/msychv.pythonanywhere.com/requirements.txt (line 2))

So what should I do with the django version?

My apologies, that was a typo in my previous post (which I've just fixed) -- there should be only one = after the --python, so the command should be this:

pa_autoconfigure_django.py --python=python3.7 --nuke https://github.com/<my-git-project-repo>.git

Okay the command with --python=python3.7 didn't work but I decided to try it with --python=3.7 and I think it did work because I got past the point where all the previous errors occurred. Still when it got to the point of migrating database I got another error:

< Running migrate database >
   \
    ~<:>>>>>>>>>
Traceback (most recent call last):
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/django/db/backends/base/base.py", line 220, in ensure_connection
    self.connect()
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/django/utils/asyncio.py", line 26, in inner
    return func(*args, **kwargs)
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/django/db/backends/base/base.py", line 197, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/django/utils/asyncio.py", line 26, in inner
    return func(*args, **kwargs)
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 233, in get_new_connection
    return Database.connect(**conn_params)
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/MySQLdb/__init__.py", line 84, in Connect
    return Connection(*args, **kwargs)
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/MySQLdb/connections.py", line 179, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
MySQLdb._exceptions.OperationalError: (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/msychv/msychv.pythonanywhere.com/manage.py", line 21, in <module>
    main()
  File "/home/msychv/msychv.pythonanywhere.com/manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/django/core/management/base.py", line 328, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/django/core/management/base.py", line 366, in execute
    self.check()
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/django/core/management/base.py", line 395, in check
    include_deployment_checks=include_deployment_checks,
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/django/core/management/commands/migrate.py", line 63, in _run_checks
    issues = run_checks(tags=[Tags.database])
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/django/core/checks/registry.py", line 72, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/django/core/checks/database.py", line 10, in check_database_backends
    issues.extend(conn.validation.check(**kwargs))
    return Connection(*args, **kwargs)
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/django/db/backends/mysql/validation.py", line 9, in check
    issues.extend(self._check_sql_mode(**kwargs))
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/django/db/backends/mysql/validation.py", line 13, in _check_sql_mode
    with self.connection.cursor() as cursor:
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/django/utils/asyncio.py", line 26, in inner
    return func(*args, **kwargs)
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/django/db/backends/base/base.py", line 260, in cursor
    return self._cursor()
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/django/db/backends/base/base.py", line 236, in _cursor
    self.ensure_connection()
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/django/utils/asyncio.py", line 26, in inner
    return func(*args, **kwargs)
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/django/db/backends/base/base.py", line 220, in ensure_connection
    self.connect()
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/django/db/backends/base/base.py", line 220, in ensure_connection
    self.connect()
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/django/utils/asyncio.py", line 26, in inner
    return func(*args, **kwargs)
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/django/db/backends/base/base.py", line 197, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/django/utils/asyncio.py", line 26, in inner
    return func(*args, **kwargs)
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 233, in get_new_connection
    return Database.connect(**conn_params)
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/MySQLdb/__init__.py", line 84, in Connect
    return Connection(*args, **kwargs)
  File "/home/msychv/.virtualenvs/msychv.pythonanywhere.com/lib/python3.7/site-packages/MySQLdb/connections.py", line 179, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
django.db.utils.OperationalError: (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)")
Traceback (most recent call last):
  File "/home/msychv/.local/bin/pa_autoconfigure_django.py", line 47, in <module>
    main(arguments['<git-repo-url>'], arguments['--domain'], arguments['--python'], nuke=arguments.get('--nuke'))
  File "/home/msychv/.local/bin/pa_autoconfigure_django.py", line 38, in main
    project.run_migrate()
  File "/home/msychv/.local/lib/python3.6/site-packages/pythonanywhere/django_project.py", line 96, in run_migrate
    'migrate',
  File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/msychv/.virtualenvs/msychv.pythonanywhere.com/bin/python', '/home/msychv/msychv.pythonanywhere.com/manage.py', 'mi
grate']' returned non-zero exit status 1.

How do your db settings look like?

This is what I have in settings.py

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'vinylshop',
        'USER': 'root',
        'PASSWORD': <removed>,
        'HOST': 'localhost',
        'PORT': '3306',
    }
}

It works fine on the local server (python manage.py runserver)

Your setup assumes that there is a MySQL database server running on localhost, which is not the case on PythonAnywhere. To use MySQL, you can start a server using the "Databases" page on our site, and then you'll need to put the connection details that are displayed there into your settings.py.

I'm so so grateful for your help! I finally got it working. Thank you for your time and advice, I really appreciate it

Glad we could help!

Hello, I'm having this same issue, could you update my system image?

No problem, I have updated your system image.

Hello, The same issue on me! Could you update my system image?

No problem, I have updated your system image.

Hello! I am having the same issue. Please update my system image accordingly. Thanks

Sure! One word of warning first -- because of the changes to the point releases of Python, any virtualenvs you have might break -- and if you're not using virtualenvs, the pre-installed Python modules will be upgraded so that might break any code you have that relies on the old installed versions.

If you're happy for us to switch you over despite that, then let us know.

Yes, please switch me over

OK -- that's done now.

Hi, I cannot access to admin as well. Can you switch mine over as well?

No problem. That's done now.

I am having the same problem and I am using Django 3. could you please update my system image

Sure, we've updated your system image.

Hi I think I'm having the same problem, could you migrate me to the new system image please? I'm using django 3.

No problem. I have updated your system image.

Hello, I'm using django 3 and am experiencing the same issue. The only issue is with ....../admin but I have been navigating this by avoiding the admin panel and going straight to the apps e.g ...../admin/accounts/user . Anyway, update the system image.

Based on our email conversation, I'm guessing that you don't want your system image to be updated any more.

Thank you for the quick and effective response Glenn. This why I will always stick with PythonAnywhere.

:-)

Hi I think I'm having the same problem, could you migrate me to the new system image please? I'm using django 3.7 Kind regards, Guillermo

Sure, no problem -- that's done now. Your website will pick up the new system image the next time it is restarted.

great! works ok!

Glad to hear that!

I was implementing django_otp to my admin and everything was okay, no more 502. I could access the admin panel until I used the django.contrib.admin. Since django_otp admin site inherits from django.contrib.admin, maybe this can help debug and fix the error.

Given that the error is a bug in Python 3.7.0, which is fixed in 3.7.5, then we're not going to try to fix it ourselves. It's interesting that adding django_otp fixes it, though -- perhaps it overrides part of the admin code with something that doesn't trigger the bug.

I am having the same issue as I am running django 3.0.6... could you switch the system image for me?

Sure, we can switch you over to the new system image. This may break your code and you need to rebuild your virtualenvs. Reply to confirm if you want to proceed.

Yes please... That would be great... I'll fix the any issues that I can on my end.... Also, I wrote the code in Python 3.8, I hope that is not a deal breaker in any way...

okay, I've switched you over.

Thanks a lot... You really did me a solid there... Everything works now... 5 stars

I'm running into the same issue. Could you switch me over to the new image as well?

No problem. I have switched the system image for your account.

Yo, I have the same problem. Can u help me too?)

Sure, switching you over to the most recent one. (Just a reminder that it can break your code and you will need to rebuild your virtual environments. You will have to reload the web app to see the change.)

Hello, can you please help me to debug? I have an 502 error as well. I am using django 3.1 on my laptop, and using Python 3.8.3 when i built website locally. Thanks in advance!

are there any errors in your error log?

i dont see any..

Are you getting the error specifically on the Django admin pages? Or are there other different views on your site that are generating that error? Also, are you sure you're looking in the right place for the error log? I see lots of errors from sklearn in our copy of it.

Yes, i am getting the error when i tried to load the website: Something went wrong :-( This website is hosted by PythonAnywhere, an online hosting environment. Something went wrong while trying to load it; please try again later.

Debugging tips If this is your PythonAnywhere-hosted 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 — you can view them from the Web tab inside PythonAnywhere.

If there's nothing in the logs, and you're sure your site is OK, then it might be a problem on our side. Drop us a line at support@pythonanywhere.com, in the forums, or using the "Send feedback" link on the site, quoting the error code below.

Error code: 502-backend

I don' see any errors from sklearn, or could you please direct me to the correct error log to make sure we are looking at the same thing?..

If you go to the "Web" page inside PythonAnywhere, then scroll about halfway down, you'll see a section headed "Log files". There are three links there, and the second one is "Error log" -- that's the one I'm talking about. At the bottom of the file you'll see the most recent error messages -- I'd recommend that you check those out because there may be some important stuff there.

However, looking at your site in more detail, I think that one possibility is that you're running out of memory -- in the server log (there's a link next to the one to the error log) you can see things like this:

2020-09-26 19:25:38 DAMN ! worker 2 (pid: 6) died, killed by signal 9 :( trying respawn ...

That often means that you've run out of memory -- I see that you've unsubscribed from resource warning emails, but if you subscribed to those (account page / email tab) then you might find that you're getting messages warning you that your code has run out of memory and been restarted. That would generate the 502 errors that you're seeing.

hi, i am having the same issue with my django admin! Could you update my system image?

No problem, you're switched to the most recent one.

Ummm, kinda feel awkward asking it again ><, but I'm also in the need of that updating, sir!

Hi @couzhei -- you're on the most recent one already.

Just a note to say that you no longer need to ask to have your system image changed -- you can change it yourself from the "Account" page. There's more information on this help page.