skip to Main Content

I am a new to web development.I have created Django(-v 2.2) web application and I want to deploy it on my linux server(OS Centos).After installation apache2, when I was going to install libapache2-mod-wsgi-py3, it says that no package available. Is there different name for libapache2-mod-wsgi-py3 for OS Centos?

2

Answers


  1. It is always recommended to install mod_wsgi directly into the python3 package using pip3.
    pip3 install mod_wsgi
    If you install mod_wsgi into the OS, it could cause conflict and unexpected behavior.

    Login or Signup to reply.
  2. Do you have apache2-dev installed?
    Also, for mod_wsgi it is better to go the CMMI path (configure-make-make install) in order to compile it with the correct version and load it in Apache as a module. This worked for me on Debian VPS:

    To do so,

    wget https://github.com/GrahamDumpleton/mod_wsgi/archive/4.6.5.tar.gz
    
    tar xvfz 4.6.5.tar.gz 
    
    cd mod_wsgi-4.6.5 
    
    whereis apxs 
    whereis python3 
    
    ./configure --with-apxs=/usr/bin/apxs --with-python=/usr/bin/python3.5 
    
    make 
    
    sudo make install 
    

    Double check the path for apxs and python, and run make install as sudo.

    When it’s all ready, check the last line of prompt results, as there will be a path to a file: /usr/lib/apache2/modules/mod_wsgi.so

    To cleanup after installation, run:

    make clean

    If you need to build the module for a different version of Apache, you should run:

    make distclean

    If you have a httpd.conf file, you should edit and add this line:

    LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so

    If not, create it and paste that line, and edit /etc/apache2/apache2.conf. file, by adding this line:

    Include /etc/apache2/httpd.conf

    You don’t need that file to configure apache, but you can create it if other software relies on it being there.

    You should restart Apache and check the log
    sudo tail /var/log/apache2/error.log

    as there should be a line that says:
    Apache/2.4.25 (Debian) mod_wsgi/4.6.5 Python/3.5 configured -- resuming normal operations

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