-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_new_site.py
More file actions
110 lines (90 loc) Β· 3.93 KB
/
setup_new_site.py
File metadata and controls
110 lines (90 loc) Β· 3.93 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/usr/bin/env python3
"""
Setup script for new modern website
Copies content from static_site and creates additional pages
"""
import os
import shutil
from pathlib import Path
def ensure_dir(path):
"""Ensure directory exists"""
os.makedirs(path, exist_ok=True)
def setup_new_site():
"""Setup the new modern website"""
print("π Setting up modern Charles O. Perry website...")
# Create directory structure
directories = [
'new_site/sculpture',
'new_site/jewelry',
'new_site/puzzles',
'new_site/chairs',
'new_site/bio',
'new_site/css',
'new_site/js'
]
for directory in directories:
ensure_dir(directory)
# Copy media files from static_site if it exists
if os.path.exists('static_site/media'):
print("π Copying media files...")
if os.path.exists('new_site/media'):
shutil.rmtree('new_site/media')
shutil.copytree('static_site/media', 'new_site/media')
print("β
Media files copied")
else:
print("β οΈ static_site/media not found - run generate_static_advanced.py first")
# Copy from Django media directory as fallback
if os.path.exists('media'):
print("π Copying from Django media directory...")
if os.path.exists('new_site/media'):
shutil.rmtree('new_site/media')
shutil.copytree('media', 'new_site/media')
print("β
Media files copied from Django directory")
# Copy HTML files from static_site if available
if os.path.exists('static_site'):
print("π Copying HTML content...")
# Copy sculpture pages
if os.path.exists('static_site/sculpture'):
shutil.copytree('static_site/sculpture', 'new_site/sculpture', dirs_exist_ok=True)
# Copy jewelry pages
if os.path.exists('static_site/jewelry'):
shutil.copytree('static_site/jewelry', 'new_site/jewelry', dirs_exist_ok=True)
# Copy puzzle pages
if os.path.exists('static_site/puzzles'):
shutil.copytree('static_site/puzzles', 'new_site/puzzles', dirs_exist_ok=True)
# Copy chair pages
if os.path.exists('static_site/chairs'):
shutil.copytree('static_site/chairs', 'new_site/chairs', dirs_exist_ok=True)
# Copy bio pages
if os.path.exists('static_site/bio'):
shutil.copytree('static_site/bio', 'new_site/bio', dirs_exist_ok=True)
print("β
HTML content copied")
else:
print("β οΈ static_site directory not found")
print(" Run 'python generate_static_advanced.py' first to generate content")
print(f"\nπ New modern website setup complete!")
print(f"π Location: new_site/")
print(f"π Open new_site/index.html in your browser to view")
# Check what was created
if os.path.exists('new_site/index.html'):
print("\nπ Created files:")
print(" β
index.html (modern homepage)")
print(" β
css/main.css (modern styling)")
print(" β
js/main.js (interactive features)")
if os.path.exists('new_site/media'):
media_count = sum([len(files) for _, _, files in os.walk('new_site/media')])
print(f" β
media/ ({media_count} files)")
if os.path.exists('new_site/sculpture'):
print(" β
sculpture/ (gallery pages)")
if os.path.exists('new_site/jewelry'):
print(" β
jewelry/ (collection pages)")
return True
if __name__ == "__main__":
if setup_new_site():
print("\n⨠Setup completed successfully!")
print("\nTo view the new website:")
print("1. Open new_site/index.html in your browser")
print("2. Or serve with: python -m http.server 8080 --directory new_site")
else:
print("\nβ Setup failed")
exit(1)