0

hi i know this is repetitive question but i checked everywhere and i checkd my urls and import stuffs but it does not fix i don't know which file path is incorrect i clone my project from github and my project in localhost works all right but in pythonanywhere.com i have this error here is my wsgi.py code:

import os
import sys

path = '/home/gazegan/blood-donor/bblood/'
if path not in sys.path:
sys.path.append(path)


os.environ['DJANGO_SETTINGS_MODULE'] = 'bblood.settings'
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

and this is the full error:

Error running WSGI application
ModuleNotFoundError: No module named 'django.contrib.admin'
File "/var/www/gazegan_pythonanywhere_com_wsgi.py", line 57, in <module>
application = get_wsgi_application()

File "/home/gazegan/.virtualenvs/myenv/lib/python3.8/site- 
packages/django/core/wsgi.py", line 12, in
django.setup(set_prefix=False)
File "/home/gazegan/.virtualenvs/myenv/lib/python3.8/site- 
packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/gazegan/.virtualenvs/myenv/lib/python3.8/site- 
packages/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "/home/gazegan/.virtualenvs/myenv/lib/python3.8/site- 
packages/django/apps/config.py", line 136, in create
import_module(entry)

please help me :(

gazegan
  • 25
  • 1
  • 6
  • What did you set as the path to the source code and working directory on python anywhere web configuration page? – sin tribu Apr 16 '20 at 23:36
  • my project name is `bblood` this is my source code `/home/gazegan/blood-donor/bblood` for example manage.py file is stored in `/home/gazegan/blood-donor/bblood/manage.py`. and my working directory is `home/gazegan/` – gazegan Apr 17 '20 at 09:59
  • by the way i configurate the admin static files like what in tutorial said. in static part of web configuration i add this `/home/gazegan/.virtualenvs/myenv/lib/python3.8/site-packages/django/contrib/admin/static/admin` and `/static/admin/` as url mybe that is the problem :( – gazegan Apr 17 '20 at 10:07
  • 3
    It appears that you can import django, but not django.contrib.admin, so that makes me think that your installation of django is broken in some way. Try deleting and rebuilding your virtualenv. – Glenn Apr 17 '20 at 10:20
  • Yeeesss, You were right my problem solved! thank you very much @Glenn – gazegan Apr 17 '20 at 12:14

0 Answers0