pythondjangodjango-simple-history

ModuleNotFoundError: No module named 'simple_history' Pythonanywhere


I have a Django app running on pythonanywhere server. I have installed the requirements.txt and everything is okay, python manage.py migrate also successfully done. now when I reload my app I get following error.

2023-09-29 00:42:43,481: Error running WSGI application
2023-09-29 00:42:43,514: ModuleNotFoundError: No module named 'simple_history'
2023-09-29 00:42:43,514:   File "/var/www/app_umrahpro_me_wsgi.py", line 16, in <module>
2023-09-29 00:42:43,514:     application = get_wsgi_application()
2023-09-29 00:42:43,514: 
2023-09-29 00:42:43,514:   File "/home/HBNmughal/.local/lib/python3.10/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2023-09-29 00:42:43,515:     django.setup(set_prefix=False)
2023-09-29 00:42:43,515: 
2023-09-29 00:42:43,515:   File "/home/HBNmughal/.local/lib/python3.10/site-packages/django/__init__.py", line 24, in setup
2023-09-29 00:42:43,515:     apps.populate(settings.INSTALLED_APPS)
2023-09-29 00:42:43,515: 
2023-09-29 00:42:43,515:   File "/home/HBNmughal/.local/lib/python3.10/site-packages/django/apps/registry.py", line 91, in populate
2023-09-29 00:42:43,516:     app_config = AppConfig.create(entry)
2023-09-29 00:42:43,516: 
2023-09-29 00:42:43,516:   File "/home/HBNmughal/.local/lib/python3.10/site-packages/django/apps/config.py", line 193, in create
2023-09-29 00:42:43,516:     import_module(entry)
2023-09-29 00:42:43,516: ***************************************************
2023-09-29 00:42:43,520: If you're seeing an import error and don't know why,
2023-09-29 00:42:43,520: we have a dedicated help page to help you debug: 
2023-09-29 00:42:43,521: https://help.pythonanywhere.com/pages/DebuggingImportError/
2023-09-29 00:42:43,521: ***************************************************

  

It should be reloaded without any error


Solution

  • There are multiple versions of Python installed on PythonAnywhere. When deploying a web app, one needs to check if they installed the required packages for the same Python version and virtual environment (if used) as the web is set up to use. If some packages have been installed after the deployment, the web app should be reloaded.