0

I have researched a lot and found this is a very common question. But the fact is I believe somehow pythonanywhere can not detect my settings.py file. Moreover, I have checked with the settings file directory and it is the same path as I have input in the WSGI file. I have also installed the required pip files but still getting the same errors.

Error running WSGI application

ModuleNotFoundError: No module named 'widget_tweaks'

File "/var/www/ewallet_pythonanywhere_com_wsgi.py", line 33, in <module>

application = get_wsgi_application()

File "/home/ewallet/.virtualenvs/myenv/lib/python3.7/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
     django.setup(set_prefix=False)

File "/home/ewallet/.virtualenvs/myenv/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
     apps.populate(settings.INSTALLED_APPS)

File "/home/ewallet/.virtualenvs/myenv/lib/python3.7/site-packages/django/apps/registry.py", line 91, in populate
    app_config = AppConfig.create(entry)

File "/home/ewallet/.virtualenvs/myenv/lib/python3.7/site-packages/django/apps/config.py", line 90, in create
    module = import_module(entry)

Here is the wsgi.py

import os
import sys

path = '/home/ewallet/E-wallet/ewallet/ewallet/'
if path not in sys.path:
    sys.path.append(path)

from django.core.wsgi import get_wsgi_application

os.environ['DJANGO_SETTINGS_MODULE'] = 'ewallet.settings'

application = get_wsgi_application()

Here is the directory image enter image description here

Kindly help me to find the bug here. Thank you

6
  • error is not about of pythonanywhere not able to detect your settings.py file error is coming because you forgot to install a package named as django-widget-tweaks run this command in your pythonanywhere bash pip install django-widget-tweaks and restart your webapp Commented Oct 3, 2021 at 12:31
  • Hi, @AnkitTiwari as I mentioned, "I have also installed the required pip files but still getting the same errors." so yes I have installed every pip it required. Commented Oct 4, 2021 at 6:27
  • Hello @Toufiqur Rahman than this may be old error go to the error log and check at the bottom to see latest error Commented Oct 4, 2021 at 6:52
  • If the error is same than do check for given package in your pythonanywhere bash by running this command pip freeze Commented Oct 4, 2021 at 6:53
  • 1
    Make sure that you have installed the module for the version of Python/virtualenv that you are using to run your code. See help.pythonanywhere.com/pages/InstallingNewModules for more details. Commented Oct 4, 2021 at 9:41

1 Answer 1

1

You just entered path incorrectly. It should be as following:

path = '/home/ewallet/E-wallet/ewallet

So, correct version of your wsgi.py is as following:

import os
import sys

path = '/home/ewallet/E-wallet/ewallet/ewallet/'
if path not in sys.path:
    sys.path.append(path)

from django.core.wsgi import get_wsgi_application

os.environ['DJANGO_SETTINGS_MODULE'] = 'ewallet.settings'

application = get_wsgi_application()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.