Target WSGI script cannot be loaded as Python module.
Alexandre Brault
abrault at mapgears.com
Tue May 22 15:55:33 EDT 2018
On 2018-05-22 02:29 PM, Νίκος wrote:
> Hello all,
>
> Iam tryign to run a bootle script iw rote as wsgi app and iam gettign the follwing eroor.
>
> ===============================================================
> [Tue May 22 06:49:45.763808 2018] [:error] [pid 24298] [client 46.103.59.37:14500] mod_wsgi (pid=24298): Target WSGI script '/home/nikos/public_html/app.py' cannot be loaded as Python module.
> [Tue May 22 06:49:45.763842 2018] [:error] [pid 24298] [client 46.103.59.37:14500] mod_wsgi (pid=24298): Exception occurred processing WSGI script '/home/nikos/public_html/app.py'.
> [Tue May 22 06:49:45.763872 2018] [:error] [pid 24298] [client 46.103.59.37:14500] Traceback (most recent call last):
> [Tue May 22 06:49:45.763911 2018] [:error] [pid 24298] [client 46.103.59.37:14500] File "/home/nikos/public_html/app.py", line 4, in <module>
> [Tue May 22 06:49:45.763951 2018] [:error] [pid 24298] [client 46.103.59.37:14500] import re, os, sys, socket, time, datetime, locale, codecs, random, smtplib, subprocess, geoip2.database, bottle_pymysql
> [Tue May 22 06:49:45.763976 2018] [:error] [pid 24298] [client 46.103.59.37:14500] ImportError: No module named geoip2.database
> ===============================================================
>
> He is the relative httpd-vhosts.conf
>
> <VirtualHost superhost:*>
> ServerName superhost.gr
>
> WSGIDaemonProcess public_html user=nikos group=nikos processes=1 threads=5
> WSGIScriptAlias / /home/nikos/public_html/app.py
>
> ProxyPass / http://superhost.gr:5000/
> ProxyPassReverse / http://superhost:5000/
>
>
> <Directory /home/nikos/public_html>
> WSGIProcessGroup public_html
> WSGIApplicationGroup %{GLOBAL}
> WSGIScriptReloading On
>
> Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
>
> AddHandler cgi-script .cgi .py
> AddHandler wsgi-script .wsgi .py
>
> AllowOverride None
> Require all granted
> </Directory>
> </VirtualHost>
>
>
> Any ideas as to why iam getting the above error although i have python36 isntalled along with all modules? why can it find it?
How did you install geoip2? Was it by any chance in a virtual
environment? If it was, you need to tell mod_wsgi to use this virtual
environment; otherwise, it'll use the global environment that probably
doesn't have geoip2 installed
Alex
More information about the Python-list
mailing list