How did you modify the wsgi.py file? If this was an issue with not seeing the virtual environment correctly, you would usually adjust the python-home option, not make changes in the wsgi.py file. If it is a mismatch in Python versions, you will end up with problems still later if trying to force crossing of versions by adding site-packages directory explicitly.
If you say what the changes were, then can indicate whether it is the correct way of fixing things or whether should be solved a different better way. > On 30 May 2020, at 9:46 am, Prajwal Gautam <[email protected]> > wrote: > > I fixed the problem. I had to modify the wsgi.py file and it worked. > Thank you though! > > On Friday, May 29, 2020 at 5:56:58 AM UTC-5, Graham Dumpleton wrote: > If Django is definitely installed in the Python virtual environment, most > likely the issue is that mod_wsgi was compiled for a different Python version > that Python 3.8. > > See: > > > https://modwsgi.readthedocs.io/en/develop/user-guides/checking-your-installation.html#python-installation-in-use > > <https://modwsgi.readthedocs.io/en/develop/user-guides/checking-your-installation.html#python-installation-in-use> > > You can use mod_wsgi compiled for Python 3.6 or 3.7 with a Python virtual > environment created with Python 3.8. > > Another cause is that permissions on installed Python packages (Django) are > such that the Apache user cannot access them. > > Confirm what version of Python mod_wsgi is compiled for. > > Also run Python interpreter with activate Python virtual environment and do: > > import django > print(django.__file__) > > Check that the directory where it is installed doesn't have restrictive > permissions. > > Graham > >> On 29 May 2020, at 8:47 pm, Prajwal Gautam <gunn.pra...@ <>gmail.com >> <http://gmail.com/>> wrote: >> >> Hi, >> >> Sorry about that. >> Here's the error.log file: >> >> mod_wsgi (pid=147546): Failed to exec Python script file >> '/home/prajwael/django_project/django_project> >> >> mod_wsgi (pid=147546): Exception occurred processing WSGI script >> '/home/prajwael/django_project/django> >> >> Traceback (most recent call last): >> >> File "/home/prajwael/django_project/django_project/wsgi.py", line 12, in >> <module> >> >> [wsgi:error] from django.core.wsgi import get_wsgi_application >> >> [wsgi:error] ModuleNotFoundError: No module named 'django' >> >> >> >> As far as the packages used, I am using Python 3.8.2, Apache/2.4.41 >> (Ubuntu), pip 20.0.2, Django==3.0.6, virtual environment is used, django is >> installed globally as well as locally. mod_wsgi was installed using the >> command: >> >> sudo apt-get install libapache2-mod-wsgi-py3 >> >> >> >> Following is in the django_project.conf file: >> >> WSGIScriptAlias / /home/prajwael/django_project/django_project/wsgi.py >> >> WSGIDaemonProcess django_app >> python-path=/home/prajwael/django_project >> python-home=/home/prajwael/django_project/venv >> >> WSGIProcessGroup django_app >> >> >> >> wsgi.py file has the following content: >> >> import os >> >> >> >> from django.core.wsgi import get_wsgi_application >> >> >> >> os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings") >> >> >> >> >> application = get_wsgi_application() >> >> >> >> Thank you >> >> >> On Thursday, May 28, 2020 at 11:51:15 PM UTC-5, Graham Dumpleton wrote: >> Can you explain your problem from the start. We don't necessarily see the >> full history of what the prior issue was about. Plus your issue could be >> entirely different. >> >> So, error you are getting and what you expect, the mod_wsgi configuration >> you are using, platform, Python version, how mod_wsgi was installed, whether >> Python virtual environment used, where is Django installed (globally, >> virtual environment, per user site packages) etc etc. In other words, any >> information that might be useful to work out what your problem is. >> >> Graham >> >>> On 29 May 2020, at 1:55 pm, Prajwal Gautam <gunn.pra...@ <>gmail.com >>> <http://gmail.com/>> wrote: >>> >>> Hi there, >>> I encountered the same problem but I havent been able to fix this issue. >>> Any form of assistance would be highly appreciated! >>> >>> On Wednesday, May 23, 2018 at 3:40:51 PM UTC-5, Tim Buckland wrote: >>> Ok, I've got this working now :) >>> >>> It seems I needed to issue this command: >>> python3 -m venv dash >>> >>> ... instead of using virtualenv which created a Python 2 virtual >>> environment! >>> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "modwsgi" group. >>> To unsubscribe from this group and stop receiving emails from it, send an >>> email to mod...@ <>googlegroups.com <http://googlegroups.com/>. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/modwsgi/ef43ace8-4ee7-4df3-836e-4a662c68ea14%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/modwsgi/ef43ace8-4ee7-4df3-836e-4a662c68ea14%40googlegroups.com?utm_medium=email&utm_source=footer>. >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "modwsgi" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to mod...@ <>googlegroups.com <http://googlegroups.com/>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/modwsgi/d99d4604-9b28-402f-8377-ca1fc78bad1d%40googlegroups.com >> >> <https://groups.google.com/d/msgid/modwsgi/d99d4604-9b28-402f-8377-ca1fc78bad1d%40googlegroups.com?utm_medium=email&utm_source=footer>. > > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/modwsgi/0723fdda-4cfa-4281-9737-0f204a628993%40googlegroups.com > > <https://groups.google.com/d/msgid/modwsgi/0723fdda-4cfa-4281-9737-0f204a628993%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/modwsgi/F9FE418E-7B7C-4726-91F7-D4C84110D909%40gmail.com.
