Forums

Error code: Unhandled Exception

Error running WSGI application

   <pre>File "/home/danguddemi/.local/lib/python3.6/site-packages/concurrent/futures/_base.py", line 381

     raise exception_type, self._exception, self._traceback

                         ^
<code>
Traceback (most recent call last):
  File "/home/danguddemi/mysite/routes.py", line 1, in <module>
    from flask import Flask, render_template, request

  File "/usr/local/lib/python3.6/dist-packages/flask/__init__.py", line 19, in <module>
    from jinja2 import Markup, escape

  File "/usr/local/lib/python3.6/dist-packages/jinja2/__init__.py", line 81, in <module>
    _patch_async()

  File "/usr/local/lib/python3.6/dist-packages/jinja2/__init__.py", line 77, in _patch_async
    from jinja2.asyncsupport import patch_all

  File "/usr/local/lib/python3.6/dist-packages/jinja2/asyncsupport.py", line 13, in <module>
    import asyncio

  File "/usr/lib/python3.6/asyncio/__init__.py", line 21, in <module>
    from .base_events import *

  File "/usr/lib/python3.6/asyncio/base_events.py", line 17, in <module>
    import concurrent.futures

  File "/home/danguddemi/.local/lib/python3.6/site-packages/concurrent/futures/__init__.py", line 8, in <module>
    from concurrent.futures._base import (FIRST_COMPLETED,

  File "/home/danguddemi/.local/lib/python3.6/site-packages/concurrent/futures/_base.py", line 381
    raise exception_type, self._exception, self._traceback
                        ^
SyntaxError: invalid syntax

Not exactly sure what is happening here. I'm not running in a virtual environment and I am pretty sure that the WSGI file is set up correctly

[edited by admin for formatting]

A syntax error usually means there's a mismatch between the code you're trying to run, and the python version that's running it. What Python version is your webapp using? And could the code that you installed with --user be the wrong version somehow?

A virtualenv might be a good way to get more clarity on what's installed where...

Error code: Unhandled Exception

Error running WSGI application

ModuleNotFoundError: No module named 'django'

File "/var/www/akr100_pythonanywhere_com_wsgi.py", line 17, in <module>

from django.core.wsgi import get_wsgi_application


If you're seeing an import error and don't know why,

we have a dedicated help page to help you debug:

https://help.pythonanywhere.com/pages/DebuggingImportError/

Have you checked this help page yet?

ModuleNotFoundError: No module named 'django' 2023-02-16 07:50:27,659: File "/var/www/adarsh9446_pythonanywhere_com_wsgi.py", line 18, in <module> 2023-02-16 07:50:27,659: from django.core.wsgi import get_wsgi_application

That would mean that you're using a virtualenv, but you have not installed Django into it; start a Bash console in the env using the link in the "Virtualenv" section on the "Web" page, and run pip install django