summaryrefslogtreecommitdiffstats
path: root/reset-django.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2024-12-12 17:08:00 +0000
committerPhilip Sargent <philip.sargent@gmail.com>2024-12-12 17:08:00 +0000
commit321f912083633417b7bc050f8c139fdfd724357e (patch)
tree7557a2ffdea3ac7fa932ddf4ece28423019abca7 /reset-django.py
parent58c9dd7d09b13acd99a4ce921401ce927f682f31 (diff)
downloadtroggle-321f912083633417b7bc050f8c139fdfd724357e.tar.gz
troggle-321f912083633417b7bc050f8c139fdfd724357e.tar.bz2
troggle-321f912083633417b7bc050f8c139fdfd724357e.zip
fixing pre-run script
Diffstat (limited to 'reset-django.py')
-rw-r--r--reset-django.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/reset-django.py b/reset-django.py
index d822d07..c363927 100644
--- a/reset-django.py
+++ b/reset-django.py
@@ -1,5 +1,6 @@
import os
import shutil
+from pathlib import Path
"""Cleans all django-created files and compiled python. Used by the
pre-run.sh script which cleans and initialises everything before
@@ -47,7 +48,11 @@ def delete_migrations():
if folder.endswith("migrations"):
for item in os.listdir(folder):
if not item.endswith("__init__.py"):
- os.remove(os.path.join(folder, item))
+ fullitem = Path(folder, item)
+ if fullitem.is_dir():
+ print(f"__ directory {item} in {folder} not deleted")
+ else:
+ os.remove(os.path.join(folder, item))
print("All migration files deleted.")
return None