运行WSGI应用程序时出错,ModuleNotFoundError:没有名为“ django_countries”的模块

时间:2019-10-03 13:36:37

标签: django pythonanywhere django-countries

我正在尝试在PythonAnywhere上部署我的webApp,但发生以下错误:

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已经成功安装,我在任何地方都使用了python的bash控制台。 我还安装了其他第三方模块,例如django-allauth,但这些都没有错误。

由于我不知道要看哪里,所以我不会根据请求发布一堆可能不相关的代码。

这是我正在尝试部署的第一个Web应用程序,非常感谢您的帮助或提示。

编辑:

(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

1 个答案:

答案 0 :(得分:1)

您用于pip命令的virtualenv是myvirtualenv,而用于Web应用程序的虚拟环境是myenv。两者都使用相同的virtualenv。