skip to Main Content

i get this eror :

 sudo service apache2 restart :


    [Thu Apr 18 13:11:02.687353 2019] [mpm_event:notice] [pid 2135:tid 140232732096384] AH00491: caught SIGTERM, shutting down
    [Thu Apr 18 13:11:03.694739 2019] [ssl:warn] [pid 2300:tid 139990910658432] AH01909: ip-*.*.*.*.ec2.internal:443:0 server certificate does NOT include an ID which matches the server name
    [Thu Apr 18 13:11:03.702921 2019] [ssl:warn] [pid 2301:tid 139990910658432] AH01909: ip-*.*.*.*.ec2.internal:443:0 server certificate does NOT include an ID which matches the server name
    [Thu Apr 18 13:11:03.703014 2019] [wsgi:warn] [pid 2301:tid 139990910658432] mod_wsgi: Compiled for Python/2.7.11.
    [Thu Apr 18 13:11:03.703018 2019] [wsgi:warn] [pid 2301:tid 139990910658432] mod_wsgi: Runtime using Python/2.7.12.

then i entered the domain we site and got in /var/log/apache2/error.log:

[Thu Apr 18 13:11:03.703598 2019] [mpm_event:notice] [pid 2301:tid 139990910658432] AH00489: Apache/2.4.18 (Ubuntu) OpenSSL/1.0.2g mod_wsgi/4.3.0 Python/2.7.12 configured -- resuming normal operations
        [Thu Apr 18 13:11:03.703617 2019] [core:notice] [pid 2301:tid 139990910658432] AH00094: Command line: '/usr/sbin/apache2'
        [Thu Apr 18 13:11:10.014862 2019] [wsgi:error] [pid 2304:tid 139990600201984] err : No module named boto
        [Thu Apr 18 13:11:10.015214 2019] [wsgi:error] [pid 2304:tid 139990600201984] [client 81.218.184.134:30333] mod_wsgi (pid=2304): Target WSGI script '/home/ubuntu/path/to/my_project/src/my_project/wsgi.py' does not contain WSGI application 'application'.

i am working with ubuntu 16.0.4 apache2 and nod_wsgi on AWS EC2, start to get up project that is working (not a new project)

printing the Exception in my wsgi.py i get :

No module named boto from 

try:
  application = get_wsgi_application()
except Exception as e:
    print "err : {}".format(e)

but i have boto install :

# pip freeze | grep boto
You are using pip version 8.1.1, however version 19.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
boto==2.49.0
boto3==1.9.112
botocore==1.12.16

here are other files that i configured according to https://docs.djangoproject.com/en/2.2/topics/install/ :
# cat /etc/apache2/mods-enabled/wsgi.load
LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so

# cat /etc/apache2/mods-enabled/wsgi.conf
<IfModule mod_wsgi.c>


WSGIPassAuthorization on

WSGIScriptAlias / /home/ubuntu/path/to/wsgi.py
WSGIPythonPath  /home/ubuntu/path/to/my_project

<VirtualHost *:80>
        <Directory "/home/ubuntu/path/to//my_project/">
                Require all granted
        </Directory>
</VirtualHost>

 ..

</IfModule>

2

Answers


  1. Chosen as BEST ANSWER

    the issue was that not all the python packages was installed , after installed all missing packages the website worked


  2. It looks like you could be missing the site-packages directory in your WSGIPythonPath directive. I usually define the python path as part of the WSGIDaemonProcess directive:

    WSGIDaemonProcess example 
        display-name=example 
        processes=2 threads=20 
        maximum-requests=10000 
        umask=0002 
        python-path=${SRV}/www:${SRV}/src:${SRV}/venv/prod_142/lib/python2.7/site-packages 
        python-eggs=${SRV}/.python-eggs
    
    WSGIScriptAlias / ${SRV}/www/example/wsgi.py  
        process-group=example      
        application-group=%{GLOBAL}
    

    You can see a more full-featured virtualhost definition in the readme at https://github.com/datakortet/dkbuild-apacheconf (I’m the author).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search