There are som errors below
sudo yum update -y
sudo yum install epel-release -y
sudo yum install python2-pip httpd mod_wsgi -y
sudo pip install virtualenv
sudo mkdir /opt/djangoproject
cd /opt/djangoproject
sudo virtualenv djangoprojectenv
sudo source djangoprojectenv/bin/activate
(djangoprojectenv) [root@centOS-7 djangoproject]# pip install django
(djangoprojectenv) [root@centOS-7 djangoproject]# django-admin --version
1.10.5
(djangoprojectenv) [root@centOS-7 djangoproject]#django-admin.py startproject myfirstproject .
nano myfirstproject/settings.py
STATIC_ROOT = os.path.join(BASE_DIR, "static/")
(djangoprojectenv) [root@centOS-7 djangoproject]#./manage.py migrate
(djangoprojectenv) [root@centOS-7 djangoproject]#./manage.py createsuperuser
Username (leave blank to use 'root'): djangoadmin
Email address: email@domain.tld
Password:
Password (again):
Superuser created successfully.
(djangoprojectenv) [root@centOS-7 djangoproject]#./manage.py collectstatic
# it do not work
(djangoprojectenv) [root@centOS-7 djangoproject]#nano djangoprojectenv/lib64/python2.7/site-packages/django/http/request.py
allowed_hosts = ['localhost', '192.168.15.193', '[::1]']
(djangoprojectenv) [root@centOS-7 djangoproject]#./manage.py runserver 0.0.0.0:8989
firewall-cmd --zone=public --add-port=8989/tcp
(djangoprojectenv) [root@centOS-7 djangoproject]# deactivate
### Apache
sudo nano /etc/httpd/conf.d/django.conf
Alias /static /opt/djangoproject/static
<Directory /opt/djangoproject/static>
Require all granted
</Directory>
<Directory /opt/djangoproject/myfirstproject>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess myfirstproject python-path=/opt/djangoproject:/opt/djangoproject/djangoprojectenv/lib/python2.7/site-packages
WSGIProcessGroup myfirstproject
WSGIScriptAlias / /opt/djangoproject/myfirstproject/wsgi.py
sudo systemctl restart httpd
sudo systemctl enable httpd
firewall-cmd --zone=public --permanent --add-port=80/tcp
sudo chown -R apache:apache /opt/djangoproject
http://192.168.15.193/admin