I am trying to deploy my Django App on AWS by following this article Link of the article.
I have done almost same but getting this error
[Sun Nov 13 16:02:45.432532 2022] [wsgi:error] [pid 116628:tid 140699140834880] [remote 171.78.234.250:51518] ModuleNotFoundError: No module named 'bitssatoshiproject>
here is my http conf file-
`
<VirtualHost *:80>
ServerAdmin ubuntu@172-31-11-19
ServerName 172-31-11-19
ServerAlias 172-31-11-19.com
ErrorLog /home/ubuntu/site/logs/error.log
CustomLog /home/ubuntu/site/logs/access.log combine
<Directory /home/ubuntu/BitsSatoshi/bitssatoshiproject>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess bits python-home=/home/ubuntu/bitsvenv python-path=/home/ubuntu/BitsSatoshi/
WSGIProcessGroup bits
WSGIScriptAlias / /home/ubuntu/BitsSatoshi/bitssatoshiproject/wsgi.py
</VirtualHost>
`
Please help me out guy, I am trying since so many days.
I tried every guide on google but no success and don't even know I am wrong. But one thing is for sure that the wsgi is not getting my virtual environment python.
Hello the issue is with this line WSGIDaemonProcess on line 14 you have not pointed wsgi to the right virtual environment directory kindly check the example below for the project structure and Apache file and you use this link for more details
django_project
└── env (All ENV File)
├── manage.py
└── my_django_project
├── init.py
├── settings.py
├── urls.py
└── wsgi.py
The file Apache configuration file
<VirtualHost *:80>
ServerAdmin admin@djangoproject.localhost
ServerName djangoproject.localhost
ServerAlias www.djangoproject.localhost
DocumentRoot /home/user/django_project
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /static /home/user/django_project/static
<Directory /home/user/django_project/static>
Require all granted
</Directory>
Alias /static /home/user/django_project/media
<Directory /home/user/django_project/media>
Require all granted
</Directory>
<Directory /home/user/django_project/my_django_project>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess django_project python-path=/home/user/django_project python-home=/home/user/django_project/env
WSGIProcessGroup django_project
WSGIScriptAlias / /home/user/django_project/my_django_project/wsgi.py
</VirtualHost>
Where django_project is the main directory and my_django_project is subdirectory in it. Change the directories in the above code respectively.
Enable the Virtual Host File for Django Project Once we created djangoproject.conf the file we need the enable that virtual host file by typing
cd /etc/apache2/sites-available
sudo a2ensite djangoproject.conf