Forums

Not able to deploy polls app....following dj4e by Dr Chuck

Hi,

I am trying to deploy dj4e.pythonanywhere.com/polls and there are errors - "2022-01-03 21:22:15,706: Error running WSGI application 2022-01-03 21:22:15,716: ModuleNotFoundError: No module named 'mysite'"

I checked the forums and fixed WSGI file on web tab, it looks like this now -

          import os
          import sys
          path = '/home/dj4ekarthik/dj4e_projects/mysite'
          if path not in sys.path:
               sys.path.insert(0, path)

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

          from django.core.wsgi import get_wsgi_application
          application = get_wsgi_application()

In the settings.py I have added dj4ekarthik.pythonanywhere.com in Allowed Hosts and added polls.apps.PillsConfig under Installed Apps. No other changes made.

Yet the deployment has not worked so far.

Any help appreciated. Thanks!

Have you already checked the error log for you web app? (And -- just to be sure: did you reload the web app on the Web page after making changes in the code?)

This is kind of embarrassing but dj4e.pythonanywhere.com/polls now works! I did not do anything since posting the message but things seem to have somehow resolved itself. I guess I'll never know what the issue was but thanks a lot for checking in.

Glad to hear that it works for you!