I have implemented my Django application on 'pythonanywhere' but when I try to load my website in logs I see the following information:
2019-02-27 20:20:37,677: Error running WSGI application
2019-02-27 20:20:37,678: ImportError: No module named 'crispy_forms'
2019-02-27 20:20:37,679: File "/var/www/zen404_pythonanywhere_com_wsgi.py", line 15, in <module>
2019-02-27 20:20:37,679: application = get_wsgi_application()
2019-02-27 20:20:37,679:
2019-02-27 20:20:37,679: File "/home/zen404/.virtualenvs/zen404.pythonanywhere.com/lib/python3.5/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2019-02-27 20:20:37,679: django.setup(set_prefix=False)
2019-02-27 20:20:37,684:
2019-02-27 20:20:37,684: File "/home/zen404/.virtualenvs/zen404.pythonanywhere.com/lib/python3.5/site-packages/django/__init__.py", line 24, in setup
2019-02-27 20:20:37,684: apps.populate(settings.INSTALLED_APPS)
2019-02-27 20:20:37,684:
2019-02-27 20:20:37,684: File "/home/zen404/.virtualenvs/zen404.pythonanywhere.com/lib/python3.5/site-packages/django/apps/registry.py", line 89, in populate
2019-02-27 20:20:37,685: app_config = AppConfig.create(entry)
2019-02-27 20:20:37,685:
2019-02-27 20:20:37,685: File "/home/zen404/.virtualenvs/zen404.pythonanywhere.com/lib/python3.5/site-packages/django/apps/config.py", line 90, in create
2019-02-27 20:20:37,685: module = import_module(entry)
Of course, I installed a virtual environment and 'crispy_forms' inside. What can trigger this error? When I run the python3 manage.py runserver command inside in Bash PythonAnywhere, the server starts correctly. But in the logs the error is still visible and the page basic does not work.
Any help will be appreciated.
EDIT
2019-02-27 21:55:48,333: Error running WSGI application
2019-02-27 21:55:48,334: ImportError: No module named 'crispy_forms'
2019-02-27 21:55:48,334: File "/var/www/zen404_pythonanywhere_com_wsgi.py", line 15, in <module>
2019-02-27 21:55:48,334: application = get_wsgi_application()
2019-02-27 21:55:48,335:
2019-02-27 21:55:48,335: File "/home/zen404/.virtualenvs/zen404.pythonanywhere.com/lib/python3.5/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2019-02-27 21:55:48,335: django.setup(set_prefix=False)
2019-02-27 21:55:48,335:
2019-02-27 21:55:48,335: File "/home/zen404/.virtualenvs/zen404.pythonanywhere.com/lib/python3.5/site-packages/django/__init__.py", line 24, in setup
2019-02-27 21:55:48,335: apps.populate(settings.INSTALLED_APPS)
2019-02-27 21:55:48,335:
2019-02-27 21:55:48,336: File "/home/zen404/.virtualenvs/zen404.pythonanywhere.com/lib/python3.5/site-packages/django/apps/registry.py", line 89, in populate
2019-02-27 21:55:48,336: app_config = AppConfig.create(entry)
2019-02-27 21:55:48,336:
2019-02-27 21:55:48,336: File "/home/zen404/.virtualenvs/zen404.pythonanywhere.com/lib/python3.5/site-packages/django/apps/config.py", line 90, in create
2019-02-27 21:55:48,336: module = import_module(entry)
2019-02-27 21:55:48,336: ***************************************************
2019-02-27 21:55:48,336: If you're seeing an import error and don't know why,
2019-02-27 21:55:48,336: we have a dedicated help page to help you debug:
2019-02-27 21:55:48,337: https://help.pythonanywhere.com/pages/DebuggingImportError/
2019-02-27 21:55:48,337: ***************************************************
BASH
(zen404.pythonanywhere.com) 21:54 ~ $ which python
/home/zen404/.virtualenvs/zen404.pythonanywhere.com/bin/python
(zen404.pythonanywhere.com) 21:55 ~ $ python -V
Python 3.5.2
(zen404.pythonanywhere.com) 21:55 ~ $ pip3 install --upgrade django-crispy-forms
Looking in links: /usr/share/pip-wheels
Requirement already up-to-date: django-crispy-forms in ./.virtualenvs/zen404.pythonanywhere.com/lib/python3.5/site-packages (1.7.2)
(zen404.pythonanywhere.com) 21:55 ~ $
Are you sure you installed the package in the right environment?
Before you install a package for your virtual environment via bash, you have to activate it:
# activate the virtualenv, adapt the path if necessary:
source /home/zen404/.virtualenvs/zen404.pythonanywhere.com/bin/activate
# checkout if the python executable is from your virtualenv
which python
# THEN install your package - for the activated virtual env
pip install --upgrade django-crispy-forms