Slozka na detaily nasazeni noveho webu + skript na sanitizaci db
This commit is contained in:
parent
b381f46b23
commit
42ccaa47b0
2 changed files with 30 additions and 0 deletions
3
deploy_v2/README
Normal file
3
deploy_v2/README
Normal file
|
@ -0,0 +1,3 @@
|
|||
Tahle slozka obsahuje vsechny detaily a popisy, jak nasadit "druhou verzi" M&M webu.
|
||||
|
||||
TODO: chybi tu popis na zprovozneni flatpages, na loaddata &c.
|
27
deploy_v2/pre_migration.py
Executable file
27
deploy_v2/pre_migration.py
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
import django
|
||||
|
||||
#### Inicializace Djanga
|
||||
sys.path.append(os.path.dirname(os.path.realpath(__file__))+'/..')
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mamweb.settings')
|
||||
django.setup()
|
||||
|
||||
## Pozor, nejde pouzit ORM, protoze kod je na jine verzi nez databaze a nejde namigrovat.
|
||||
from django.db import connection
|
||||
|
||||
|
||||
def smaz_zle_clanky():
|
||||
# Tyhle clanky vubec nejsou clanky, bude potreba je udelat cele jinak a spravne.
|
||||
#m.Problem.objects.filter(id__in=[1981, 1970, 2222]).delete()
|
||||
with connection.cursor() as cursor:
|
||||
# Nejdriv musime smazat reseni:
|
||||
cursor.execute('DELETE FROM seminar_reseni WHERE problem_id IN (1981, 1970, 2222);')
|
||||
# Nakonec i ty clanky samotne
|
||||
cursor.execute('DELETE FROM seminar_problemy WHERE id IN (1981, 1970, 2222);')
|
||||
|
||||
|
||||
smaz_zle_clanky()
|
Loading…
Reference in a new issue