1👍
Web server is not able to find existing django installation. Either you haven’t installed it yet, or you have not configured your server to use virtual environment (in case you are using it).
ImportError: No module named ‘django’
0👍
After sometime of researching and learning new things, I was able to deploy it in production. Only thing is that my setup was based on RHEL7, MySQL, Python3.5. So here are the details, you may want to change it based on Ubuntu. The mod_wsgi part is very important.
yum check-update
yum groupinstall -y "Development tools"
----------------------------------------------------------------
Apache2.4
----------------------------------------------------------------
yum install -y httpd httpd-devel
systemctl start httpd.service
systemctl enable httpd.service
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
chgrp -R apache /var/www/html
find /var/www/html -type d -exec chmod g+rx {} +
find /var/www/html -type f -exec chmod g+r {} +
chown -R user /var/www/html/
find /var/www/html -type d -exec chmod u+rwx {} +
find /var/www/html -type f -exec chmod u+rw {} +
find /var/www/html -type d -exec chmod g+s {} +
----------------------------------------------------------------
MySQL
----------------------------------------------------------------
yum install -y mariadb-server mariadb
systemctl start mariadb.service
systemctl enable mariadb.service
mysql_secure_installation
----------------------------------------------------------------
----------------------------------------------------------------
Python3.5 along with lib and devel packages
----------------------------------------------------------------
yum install -y https://rhel7.iuscommunity.org/ius-release.rpm
yum install -y python35u python35u-libs python35u-devel python35u-pip
pip3.5 install virtualenv
----------------------------------------------------------------
mod-wsgi
----------------------------------------------------------------
wget https://github.com/GrahamDumpleton/mod_wsgi/archive/4.5.14.tar.gz
tar -zxvf 4.5.14.tar.gz
cd mod_wsgi-4.5.14
./configure --with-python=/usr/bin/python3.5
make
make install
chmod 755 /usr/lib64/httpd/modules/mod_wsgi.so
----------------------------------------------------------------
portal.conf
----------------------------------------------------------------
vi /etc/httpd/conf.d/portal.conf
LoadModule wsgi_module /usr/lib64/httpd/modules/mod_wsgi.so
<VirtualHost *:80>
ServerAdmin youradmin@email.address
ServerName portal
ServerAlias portal.com
DocumentRoot /var/www/html/portal/src/
WSGIDaemonProcess portal python-path=/var/www/html/portal/src:/var/www/html/portal/venv/lib/python3.5/site-packages
WSGIApplicationGroup portal
WSGIScriptAlias / /var/www/html/portal/src/portal/wsgi.py process-group=portal
<Directory /var/www/html/portal/src>
Require all granted
</Directory>
<Directory /var/www/html/portal/src/portal>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
systemctl restart httpd
- Functional permissions in Django
- ImportError :No module named pandas
- Exclude date via .exclude
- Django dynamics ChoiceFields choices from APIs raises ValueError
Source:stackexchange.com