20 lines
No EOL
722 B
Python
20 lines
No EOL
722 B
Python
from django.shortcuts import render
|
|
from django.core.management import call_command
|
|
from django.core.cache import cache
|
|
import subprocess
|
|
|
|
def update_database(request):
|
|
call_command('makemigrations')
|
|
call_command('migrate')
|
|
message = "La base de données à bien été mise à jour !"
|
|
return render(request, 'home.html', {'message': message})
|
|
|
|
def clear_cache(request):
|
|
cache.clear()
|
|
message = "Le cache à bien été effacé !"
|
|
return render(request, 'home.html', {'message': message})
|
|
|
|
def regen_static_files(request):
|
|
call_command('collectstatic', '--noinput')
|
|
message = "Les fichiers statics ont bien été générés !"
|
|
return render(request, 'home.html', {'message': message}) |