]> wagnertech.de Git - SVBaL.git/blob - debian/eigenheimer-util.postinst
Merge branch 'master' of http://wagnertech.de/git/SVBaL
[SVBaL.git] / debian / eigenheimer-util.postinst
1 #!/bin/bash
2 set -e
3
4 ln -sf /opt/eh_app /opt/mysite/
5
6 # add application to settings.py
7 if ! grep "### EHUTIL ###" /opt/mysite/mysite/settings.py >/dev/null
8 then
9         echo "add ehutil settings to settings.py"
10         cat << EOF >> /opt/mysite/mysite/settings.py
11 ### EHUTIL ###
12
13 INSTALLED_APPS.append('eh_app.apps.EhAppConfig')
14
15 ### EHUTIL-END ###
16 EOF
17 fi
18
19 # DB anlegen/migrieren
20 /opt/mysite/manage.py migrate
21
22 # add url routing
23 if ! grep "### EHUTIL ###" /opt/mysite/mysite/urls.py >/dev/null
24 then
25         echo "add url routing"
26         cat << EOF >> /opt/mysite/mysite/urls.py
27 ### EHUTIL ###
28
29 from django.urls import include
30 urlpatterns.append(path('eh-app/', include('eh_app.urls')))
31
32 ### EHUTIL-END ###
33 EOF
34 fi
35
36 # prepare template dir
37 chown www-data:www-data /opt/eh_app/templates
38
39 # restart apache
40 systemctl restart apache2