I'm trying to deploy a simple Django app to Ubuntu 18.04 using mod_wsgi but 
am struggling to get it all to work.

I'm able to run the app using the Django development server without issue.

I also got the hello_world wsgi app to run using Apache. The problem 
appears to be with the Django environment, but I've run out of ideas on 
things to try.

Note that I'm pretty new to both Linux and Apache so the chance I have made 
some basic mistake is very high!

This is approximately what I did (among much else):

cd /
sudo apt-get install python3-pip
sudo apt-get install python3-virtualenv
sudo apt install gnome-terminal
mkdir venv
cd venv
sudo virtualenv dash
. dash/bin/activate
pip3 install Django
cd /var/www
sudo mkdir dash
sudo chmod 777 dash
cd dash
sudo git clone https://github.com/Qarj/test-results-dashboard
cd test-results-dashboard
python3 linux_new_dashboard.py

sudo apt update
sudo apt install apache2
sudo apt install apache2-dev
pip3 install mod_wsgi
mod_wsgi-express module-config | sudo tee 
/etc/apache2/conf-enabled/wsgi.conf
sudo cp /var/www/dash/test-results-dashboard/dash/httpd-vhosts_linux.conf 
/etc/apache2/sites-enabled/test-results-dashboard.conf
sudo systemctl restart apache2

(note that I also deleted the default config file in 
/etc/apache2/conf-enabled)

verify with url: *http://localhost/dash/results*

[Wed May 23 12:05:46.517907 2018] [wsgi:error] [pid 21512:tid 
139994546329344] [client 127.0.0.1:60226]   File 
"/var/www/dash/test-results-dashboard/dash/dash/wsgi.py", line 12, in 
<module>
[Wed May 23 12:05:46.517911 2018] [wsgi:error] [pid 21512:tid 
139994546329344] [client 127.0.0.1:60226]     from django.core.wsgi import 
get_wsgi_application
[Wed May 23 12:05:46.517929 2018] [wsgi:error] [pid 21512:tid 
139994546329344] [client 127.0.0.1:60226] ModuleNotFoundError: No module 
named 'django'

*The contents of test-results-dashboard.conf:*
# test-results-dashboard virtual host configs

WSGIPythonPath /var/www/dash/test-results-dashboard/dash
<VirtualHost *:80>

    #ServerName www.example.com
    #ServerAlias example.com
    #ServerAdmin [email protected]

    DocumentRoot /var/www/html

    WSGIScriptAlias /hello_world 
/var/www/dash/test-results-dashboard/tests/hello_world/wsgi-scripts/hello_world.wsgi
    <Directory 
/var/www/dash/test-results-dashboard/tests/hello_world/wsgi-scripts>
        AllowOverride None
        Require all granted
        <Files hello_world.wsgi>
            Require all granted
        </Files>
    </Directory>

    Alias /static /var/www/dash/test-results-dashboard/dash/results/static
    <Directory /var/www/dash/test-results-dashboard/dash/results/static>
        AllowOverride None
        Require all granted
    </Directory>

    WSGIScriptAlias /dash 
/var/www/dash/test-results-dashboard/dash/dash/wsgi.py
    <Directory /var/www/dash/test-results-dashboard/dash/dash>
        AllowOverride None
        Require all granted
        <Files wsgi.py>
            Require all granted
        </Files>
    </Directory>

</VirtualHost>

I'm wondering if things are mixed up between python 2 and python 3? I tried 
adding a python3 shebang to wsgi.py but that didn't help.

Thanks in advance to anyone that can provide some tips on getting to the 
bottom of this!

-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to