0

i'm trying to devloping Django project. and i'm beginner. suddenly, today my server does not work. i think i do nothing. so i don't understand what is the problem.

this is my /var/log/apache2/error.log

 mod_wsgi (pid=27808): Target WSGI script '/home/ubuntu/Django/bot/wsgi.py' cannot be loaded as Python module.
 mod_wsgi (pid=27808): Exception occurred processing WSGI script '/home/ubuntu/Django/bot/wsgi.py'.

and when I try to enterd my server http://MYURL, 500 Internal Server Error occur.

this is my wsgi.py code

import os
import sys

sys.path.append('/home/ubuntu/Django')
#sys.path.append('/home/ubutu/Django/bot')
sys.path.append('/home/ubuntu/Django/myvenv/lib/python3.5/site-packages')

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bot.settings")

application = get_wsgi_application()

since i create my project, i have done anything on my wsgi.py however the error occurred now.

ZZERJAE
  • 35
  • 5

2 Answers2

0

i finally find solution.

mod_wsgi (pid=27808): Exception occurred processing WSGI script '/home/ubuntu/Django/bot/wsgi.py'.

this was not my critical problem.

above this error,

File "/home/ubuntu/Django/chat/admin.py", line 4, in <module>
ImportError: cannot import name 'Post'

I did some extra code on my admin.py so someone who have problem, just like me, FIND REAL ERROR what you brought.

ZZERJAE
  • 35
  • 5
0

I had the exact error in my mod_wsgi and python environment. First of all,

/var/log/apache2/error.log

file must be examined for the exact error. I changed my "wsgi.py" file contents to add paths below to my python path:

/home/user/project_name
/home/user/project_name/project_dir
/home/user/project_name/project_env/lib/python3.5/site-packages

after this my problems have gone away. To cut it short, my problem was that I have a system with python 2.7 but my python environment is python 3.5 version. Hope it helps.

Mycodingproject
  • 1,031
  • 1
  • 9
  • 13