0

I am trying to get a django app running on a apache2 server both on a raspberry pi for a project of mine. The appache server is running but I can't pull up the web page as I just get an "Internal Server Error" //Log files

[Fri Apr 07 19:28:44.334749 2023] [wsgi:error] [pid 24119:tid 1965745152] [remote 192.168.50.249:54720] mod_wsgi (pid=24119): Failed to exec Python script file '/home/pi/greenhouse/greenhouse/wsgi.py'.
[Fri Apr 07 19:28:44.335018 2023] [wsgi:error] [pid 24119:tid 1965745152] [remote 192.168.50.249:54720] mod_wsgi (pid=24119): Exception occurred processing WSGI script '/home/pi/greenhouse/greenhouse/wsgi.py'.
[Fri Apr 07 19:28:44.335914 2023] [wsgi:error] [pid 24119:tid 1965745152] [remote 192.168.50.249:54720] Traceback (most recent call last):
[Fri Apr 07 19:28:44.336045 2023] [wsgi:error] [pid 24119:tid 1965745152] [remote 192.168.50.249:54720]   File "/home/pi/greenhouse/greenhouse/wsgi.py", line 12, in <module>
[Fri Apr 07 19:28:44.336068 2023] [wsgi:error] [pid 24119:tid 1965745152] [remote 192.168.50.249:54720]     from django.core.wsgi import get_wsgi_application
[Fri Apr 07 19:28:44.336139 2023] [wsgi:error] [pid 24119:tid 1965745152] [remote 192.168.50.249:54720] ModuleNotFoundError: No module named 'django'

My 000-default.conf file

<VirtualHost *:80>

    #ServerName www.example.com

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /static /home/pi/greenhouse/static
    <Directory /home/pi/greenhouse/static>
        Require all granted
    </Directory>

    <Directory /home/pi/greenhouse/greenhouse>
    <Files wsgi.py>
        Require all granted
    </Files>
    </Directory>
    
    WSGIDaemonProcess greenhouse python-path=/home/pi/greenhouse python-home=/home/pi/greenhouse/greenhouseenv
    WSGIProcessGroup greenhouse
    WSGIScriptAlias / /home/pi/greenhouse/greenhouse/wsgi.py
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

My wsgi.py file

"""
WSGI config for greenhouse project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/4.1/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'greenhouse.settings')

application = get_wsgi_application()

I have made sure that django is installed in the virtual environment and have tried a couple other things but to no avail.

907VigiL
  • 1
  • 1

0 Answers0