Projet

Général

Profil

0001-multitenant-static-files-collecting-on-initializatio.patch

Serghei Mihai (congés, retour 15/05), 20 février 2015 16:03

Télécharger (2,83 ko)

Voir les différences:

Subject: [PATCH 1/2] multitenant: static files collecting on initialization
 (#6562)

 debian/authentic2-multitenant.dirs  |  2 ++
 debian/authentic2-multitenant.init  | 14 ++++++++++++--
 debian/multitenant/debian_config.py |  3 +++
 3 files changed, 17 insertions(+), 2 deletions(-)
debian/authentic2-multitenant.dirs
1 1
etc/authentic2-multitenant
2 2
usr/lib/authentic2-multitenant
3 3
var/lib/authentic2-multitenant/tenants
4
var/lib/authentic2-multitenant/static
5
var/lib/authentic2-multitenant/collected-static
4 6
var/run/authentic2-multitenant
5 7
var/log/authentic2-multitenant
debian/authentic2-multitenant.init
23 23
BIND=unix:$PID_DIR/$NAME.sock
24 24

  
25 25
export AUTHENTIC2_SETTINGS_FILE=/usr/lib/$NAME/debian_config.py
26
MANAGE_SCRIPT="/usr/bin/$NAME-manage"
26 27

  
27 28
USER=authentic-multitenant
28 29
GROUP=authentic-multitenant
......
61 62
    install -d -m 755 -o $USER -g $GROUP $CACHE_DIR
62 63
fi
63 64

  
65
# Function collecting static files
66
do_collectstatic() {
67
    log_action_msg "Collect static files.."
68
    su $USER -p -c "$MANAGE_SCRIPT collectstatic --noinput"
69
    log_action_msg ".. done"
70
}
71

  
64 72
#
65 73
# Function that starts the daemon/service
66 74
#
......
118 126

  
119 127
do_migrate() {
120 128
    log_action_msg "Applying new migrations .."
121
    su $USER -p -c "/usr/bin/authentic2-multitenant-manage migrate_schemas --noinput"
129
    su $USER -p -c "/usr/bin/$MANAGE_SCRIPT migrate_schemas --noinput"
122 130
    log_action_msg ".. done"
123 131
}
124 132

  
125 133
case "$1" in
126 134
  start)
127 135
    do_migrate
136
    do_collectstatic
128 137
    log_daemon_msg "Starting $DESC " "$NAME"
129 138
    do_start
130 139
    case "$?" in
......
159 168
	#
160 169
	log_daemon_msg "Restarting $DESC" "$NAME"
161 170
	do_stop
162
    do_migrate
171
        do_migrate
172
        do_collectstatic
163 173
	case "$?" in
164 174
	  0|1)
165 175
		do_start
debian/multitenant/debian_config.py
12 12
VAR_DIR = os.path.join('/var/lib', PROJECT_NAME)
13 13
ETC_DIR = os.path.join('/etc', PROJECT_NAME)
14 14

  
15
STATIC_ROOT = os.path.join(VAR_DIR, 'collected-static')
16
STATICFILES_DIRS = (os.path.join(VAR_DIR, 'static'),)
17

  
15 18
# SECURITY WARNING: don't run with debug turned on in production!
16 19
DEBUG = True
17 20
TEMPLATE_DEBUG = False
18
-