sh deploy.sh
Take a look Screenshots
cd /var/www
mkdir django-certiffy
chown certiffy:certiffy django-certiffy
su certiffy
git clone https://github.com/bradymd/django-certiffy.git
cd django-certiffy
python3 -m venv venv && source venv/bin/activate
cd django_certiffy_project
python3 -m pip install -r requirements.txt
python3 -m pip install --upgrade pip
Empty file or remove it.
rm db.sqlite3
python3 manage.py migrate --fake-initial
python3 manage.py migrate --run-syncdb
DJANGO_SUPERUSER_USERNAME=admin DJANGO_SUPERUSER_PASSWORD=psw python3 manage.py createsuperuser [email protected] --noinput
BUG: The first user"admin" is put as Group "USER".
WORKAROUND: use the tab django-admin to change the Role to "ADMIN"
python3 manage.py runserver :8443
After login it should go to the "settings" page to create the settings table, check the form and "update settings".
firewall-cmd --add-rich-rule='rule family="ipv4" port port="8443" protocol="tcp" accept' --permanent
firewall-cmd --reload
HOSTNAME="$(hostname)"
sed -e 's/ALLOWED_HOSTS.*/ALLOWED_HOSTS = [ "'$HOSTNAME'" ]/' -i django_certiffy_project/django_certiffy_project/settings.py
pip install gunicorn
#cd django_certiffy_project/
# test:
# gunicorn django_certiffy_project.wsgi
# configure for certs:
#vi ../gunicorn.conf.py
#install -d /etc/systemd/system django-certiffy.service
#systemctl enable django-certiffy.service --now
[Unit]
Description=Gunicorn instance to serve django-certiffy
After=network.target
[Service]
User=certiffy
Group=certiffy
WorkingDirectory=/var/www/django-certiffy/django_certiffy_project
Environment="PATH=/var/www/django-certiffy/venv/bin"
#ExecStart=/var/www/django-certiffy/venv/bin/gunicorn --workers 3 -m 007 django_certiffy_project.wsgi
ExecStart=/var/www/django-certiffy/venv/bin/gunicorn django_certiffy_project.wsgi
[Install]
WantedBy=multi-user.target
/etc/apache/conf.d/ssl.conf:
<VirtualHost *:443>
ServerName certiffy.herts.ac.uk
SSLproxyEngine On
Timeout 600
<Directory /var/www/django-certiffy/django_certiffy_project/static>
Order allow,deny
Options Indexes
Allow from all
</Directory>
Alias /static/ /var/www/django-certiffy/django_certiffy_project/static/
Alias /static/admin/ /var/www/django-certiffy/django_certiffy_project/static/admin/
ProxyPass /static/ !
ProxyPass / http://localhost:8443/
ProxyPassReverse / "http://localhost:8443/"
ErrorLog logs/django-certiffy-error.log
TransferLog logs/django-certiffy-access.log
LogLevel warn
SSLEngine on
SSLHonorCipherOrder on
SSLCipherSuite PROFILE=SYSTEM
SSLProxyCipherSuite PROFILE=SYSTEM
SSLCertificateFile /etc/pki/tls/certs/certiffy2023.ca-bundle
SSLCertificateKeyFile /etc/pki/tls/private/certiffy2023.key
</VirtualHost>
Run crontab add twice:
python3 manage.py crontab add
python3 manage.py crontab add
python3 manage.py crontab show