djangopythonanywheredjango-countries

Error running WSGI application, ModuleNotFoundError: No module named 'django_countries'


I'm trying to deploy my webApp on PythonAnywhere but the following error occour:

2019-10-01 18:20:12,820: Error running WSGI application
2019-10-01 18:20:12,928: ModuleNotFoundError: No module named 'django_countries'
2019-10-01 18:20:12,928:   File "/var/www/namesurname_pythonanywhere_com_wsgi.py", line 33, in <module>
2019-10-01 18:20:12,929:     application = get_wsgi_application()
2019-10-01 18:20:12,929: 
2019-10-01 18:20:12,929:   File "/home/namesurname/.virtualenvs/myenv/lib/python3.7/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2019-10-01 18:20:12,929:     django.setup(set_prefix=False)
2019-10-01 18:20:12,929: 
2019-10-01 18:20:12,929:   File "/home/namesurname/.virtualenvs/myenv/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
2019-10-01 18:20:12,929:     apps.populate(settings.INSTALLED_APPS)
2019-10-01 18:20:12,930: 
2019-10-01 18:20:12,930:   File "/home/namesurname/.virtualenvs/myenv/lib/python3.7/site-packages/django/apps/registry.py", line 91, in populate
2019-10-01 18:20:12,930:     app_config = AppConfig.create(entry)
2019-10-01 18:20:12,930: 
2019-10-01 18:20:12,930:   File "/home/namesurname/.virtualenvs/myenv/lib/python3.7/site-packages/django/apps/config.py", line 90, in create
2019-10-01 18:20:12,930:     module = import_module(entry)

Django_countries is successfully already installed, I used the bash console of python anywhere. I also installed other third party modules, like django-allauth, but no error about those.

Since I have no idea where to look, instead of posting a bunch of probably non-related codes I'll post on request.

This is my first webapp I'm trying to deploy, so any help or hint is really appreciated, thanks.

edit:

(myvirtualenv) 13:21 /home $ pip list
Package             Version  
------------------- ---------
certifi             2019.9.11
chardet             3.0.4    
defusedxml          0.6.0    
Django              2.2.6    
django-allauth      0.40.0   
django-countries    5.5      
django-crispy-forms 1.7.2    
idna                2.8      
oauthlib            3.1.0    
pip                 19.2.3   
python3-openid      3.1.0    
pytz                2019.2   
requests            2.22.0   
requests-oauthlib   1.2.0    
setuptools          41.2.0   
six                 1.12.0   
sqlparse            0.3.0    
urllib3             1.25.6   
wheel               0.33.6

Solution

  • The virtualenv that you're using for the pip command is myvirtualenv and the one that you're using for the web app is myenv. Use the same virtualenv for both.