sudo apt-get install apache2# Install apache2 web server
sudo apt install apache2sudo apt-get install apache2
sudo apt-get install libapache2-mod-wsgi-py3
cd
cd /etc/apache2/sites-available/
sudo cp 000-default.conf yourfilename.conf
sudo nano yourfilename.conf
copy past the following the below code in the flower bracket
Note:dont copy those flower brackets
Note:this is if you are not running on venv
note: please specify the path as show below to those specifit file in
your djnago project
{{{{
Alias /static /home/Linux/website/static
<Directory /home/Linux/website/static>
Require all granted
</Directory>
Alias /media /home/Linux/ramtejajakka/media
<Directory /home/Linux/ramtejajakka/media>
Require all granted
</Directory>
<Directory /home/Linux/website/ramtejajakka>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIScriptAlias / /home/Linux/website/ramtejajakka/wsgi.py
WSGIDaemonProcess django_app python-path=/home/Linux/website
WSGIProcessGroup djnago_app
}}}}
note: if your are running on venv use this code
{{{
Alias /static /home/Linux/website/static
<Directory /home/Linux/website/static>
Require all granted
</Directory>
Alias /media /home/Linux/ramtejajakka/media
<Directory /home/Linux/ramtejajakka/media>
Require all granted
</Directory>
<Directory /home/Linux/website/ramtejajakka>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIScriptAlias / /home/Linux/website/ramtejajakka/wsgi.py
WSGIDaemonProcess django_app python-path=/home/Linux/website python-home=/home/Linux/website/venv
WSGIProcessGroup djnago_app
}}}
#continue running these commands
sudo a2ensite yourfilename.conf
sudo a2dissite 000-default.conf
cd
#check the path to your django project
sudo chown :www-data /home/Linux/your_dir/db.sqlite3
sudo chmod 664 /home/Linux/your_dir/db.sqlite3
sudo chown :www-data /home/Linux/your_dir
sudo chmod 775 /home/Linux/your_dir
sudo chown -R :www-data /home/Linux/your_dir/media
sudo chmod -R 775 /home/Linux/your_dir/media
sudo service apache2 restart
sudo apt install apache2