Forums

django-blacklist

getting the server error when accessing webpage with django-blacklist configure:

2023-09-20 14:37:19,865: Error running WSGI application 2023-09-20 14:37:19,873: ModuleNotFoundError: No module named 'blacklist' 2023-09-20 14:37:19,873: File "/var/www/www_WEGPAGE_com_wsgi.py", line 43, in <module> 2023-09-20 14:37:19,873: application = get_wsgi_application()

But as seen blacklist is installed: python3 -m pip install django-blacklist --user Looking in links: /usr/share/pip-wheels Requirement already satisfied: django-blacklist in /home/USER/.local/lib/python3.8/site-packages (0.7.0) Requirement already satisfied: Django in /usr/lib/python3.8/site-packages (from django-blacklist) (2.2.7) Requirement already satisfied: sqlparse in /usr/lib/python3.8/site-packages (from Django->django-blacklist) (0.3.0) Requirement already satisfied: pytz in /usr/lib/python3.8/site-packages (from Django->django-blacklist) (2019.3)

settiings.py as INSTALLED_APPS and MIDDLEWARE set with: 'blacklist', and 'blacklist.middleware.BlacklistMiddleware',

I have validate django-blacklist on my standalone development computer

Thanks for the help Chris

Make sure that you have it installed in the python version/virtualenv that you are using for your web app: https://help.pythonanywhere.com/pages/InstallingNewModules/

Glenn Thanks for replying.... It is installed as the example shows above and as the link you provided says to do: "pip3.6 install --user pwhich". I did.... "python3 -m pip install django-blacklist --user" To prove it was installed I then did what I sent before: "python3 -m pip install django-blacklist --user". which then dumps..... Requirement already satisfied: django-blacklist in /home/USER/.local/lib/python3.8/site-packages (0.7.0) Requirement already satisfied: Django in /usr/lib/python3.8/site-packages (from django-blacklist) (2.2.7) Requirement already satisfied: sqlparse in /usr/lib/python3.8/site-packages (from Django->django-blacklist) (0.3.0) Requirement already satisfied: pytz in /usr/lib/python3.8/site-packages (from Django->django-blacklist) (2019.3) When I do "python3 ./manage.py migrate blacklist" I get a good "Ok" reply. However, when I try loading my webpage via the Web console the server.log files dumps the error I sent.

What is missing here? thanks Chris

Is your web app using Python 3.8?

python3 --version Python 3.8.0

That command tells you which version is run from the console, but it could potentially be configured to use a different version on the "Web" page.

However, I've checked your website's configuration (the data that you would see on the "Web" page inside PythonAnywhere, and I see that you are indeed specifying Python 3.8 there. However, you are also using a virtualenv, so your site will only see packages that you have installed into that specific virtualenv. When you were running the various pip commands in your message above, no virtualenv was activated.

To install a package into your virtualenv, either use the "workon ENVNAME" command to activate it, or use the "Start a Bash console in this virtualenv" link on the "Web" page. Then you can install the package using pip.

Giles Thanks, feel like a real gnome here, I didn't pay attention to the console prompt at all! aka "(oamvenv) 19:55 ~/OnAirNetScraperServer". that clearly tags you're in the env..... So while I did manage to install the package in the right env, later when I tried running the manage.py migrate command I wasn't in the env....... sometimes this old grey matter just looses it.......grrrrrr I need to test but this will have to be later working another issue at the moment Thanks again....Chris

Let us know if you have more questions!