136 activate_path = os.path.join(remotevirtualenvpath, "bin/activate") |
136 activate_path = os.path.join(remotevirtualenvpath, "bin/activate") |
137 with prefix("source \"%s\"" % activate_path), prefix("export PYTHONPATH=\"%s\"" % remotepath), cd(remotepath): |
137 with prefix("source \"%s\"" % activate_path), prefix("export PYTHONPATH=\"%s\"" % remotepath), cd(remotepath): |
138 #remocve old files optio -c of collect static fail ! |
138 #remocve old files optio -c of collect static fail ! |
139 run("rm -fr \"%s\"" % (remotestaticsitepath)) |
139 run("rm -fr \"%s\"" % (remotestaticsitepath)) |
140 run("python manage.py collectstatic --noinput") |
140 run("python manage.py collectstatic --noinput") |
|
141 |
|
142 def syncdb(remotepath, remotevirtualenvpath): |
|
143 activate_path = os.path.join(remotevirtualenvpath, "bin/activate") |
|
144 with prefix("source \"%s\"" % activate_path), prefix("export PYTHONPATH=\"%s\"" % remotepath), cd(remotepath): |
|
145 run("python manage.py syncdb --migrate --noinput") |
141 |
146 |
142 def create_config(export_path): |
147 def create_config(export_path): |
143 print("Create config from %s" % (export_path,)) |
148 print("Create config from %s" % (export_path,)) |
144 remotepath = env.remote_path['src'] |
149 remotepath = env.remote_path['src'] |
145 remote_config_path = os.path.join(remotepath, env.platform_web_module, "config.py") |
150 remote_config_path = os.path.join(remotepath, env.platform_web_module, "config.py") |
225 if not exists(folder_path): |
230 if not exists(folder_path): |
226 run("mkdir -p \"%s\"" % folder_path) |
231 run("mkdir -p \"%s\"" % folder_path) |
227 run("chown -R -c :%s \"%s\"" % (env.web_group, folder_path)) |
232 run("chown -R -c :%s \"%s\"" % (env.web_group, folder_path)) |
228 run("chmod -R -c g+w \"%s\"" % folder_path) |
233 run("chmod -R -c g+w \"%s\"" % folder_path) |
229 @task |
234 @task |
230 def relaunch_server(do_collectstatic=True): |
235 def relaunch_server(do_collectstatic=True, do_syncdb=True): |
231 print("Relaunch server") |
236 print("Relaunch server") |
232 check_folder_access() |
237 check_folder_access() |
|
238 if do_syncdb: |
|
239 syncdb(env.remote_path['src'], env.remote_path['virtualenv']) |
233 if do_collectstatic: |
240 if do_collectstatic: |
234 collectstatic(env.remote_path['src'], env.remote_path['virtualenv'], env.platform_web_module) |
241 collectstatic(env.remote_path['src'], env.remote_path['virtualenv'], env.platform_web_module) |
235 sudo(env.web_relaunch_cmd, shell=False) |
242 sudo(env.web_relaunch_cmd, shell=False) |
236 |
243 |
237 @task |
244 @task |