-
Notifications
You must be signed in to change notification settings - Fork 1
/
clean.py
45 lines (34 loc) · 1.08 KB
/
clean.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import os
import shutil
from config.settings import BASE_DIR
from pathlib import Path
path1= Path(os.path.normpath(str(BASE_DIR)+"/config/__pycache__"))
path2= Path(os.path.normpath(str(BASE_DIR)+"/tagyourtree/migrations"))
path3=Path(os.path.normpath(str(BASE_DIR)+'/db.sqlite3'))
path4= Path(os.path.normpath(str(BASE_DIR)+"/static/"))
try:
shutil.rmtree(path1)
except OSError as e:
print ("Error: %s - %s." % (e.filename, e.strerror))
try:
shutil.rmtree(path2)
except OSError as e:
print ("Error: %s - %s." % (e.filename, e.strerror))
try:
os.remove( path3)
except OSError as e:
print ("Error: %s - %s." % (e.filename, e.strerror))
try:
shutil.rmtree( path4)
except OSError as e:
print ("Error: %s - %s." % (e.filename, e.strerror))
cmd1= "python manage.py makemigrations"
cmd2= "python manage.py makemigrations tagyourtree"
cmd3="python manage.py migrate"
cmd4="python manage.py runserver"
cmd5="python manage.py createsuperuser --username admin --email [email protected] --skip-checks"
os.system(cmd1)
os.system(cmd2)
os.system(cmd3)
os.system(cmd5)
os.system(cmd4)