node entfernt
This commit is contained in:
53
setup.py
Executable file
53
setup.py
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
def main():
|
||||
"""Set up the project from the parent directory"""
|
||||
print("Setting up the project...")
|
||||
|
||||
# Get the directory where setup.py is located (project root)
|
||||
project_root = Path(__file__).resolve().parent
|
||||
website_dir = project_root / "website"
|
||||
|
||||
# Check if virtual environment exists, create if not
|
||||
venv_dir = project_root / "venv"
|
||||
if not venv_dir.exists():
|
||||
print("Creating virtual environment...")
|
||||
subprocess.run([sys.executable, "-m", "venv", str(venv_dir)], check=True)
|
||||
|
||||
# Determine pip path based on OS
|
||||
if os.name == 'nt': # Windows
|
||||
pip = venv_dir / "Scripts" / "pip"
|
||||
else: # Unix-like
|
||||
pip = venv_dir / "bin" / "pip"
|
||||
|
||||
# Install dependencies
|
||||
print("Installing dependencies...")
|
||||
subprocess.run([str(pip), "install", "-r", str(website_dir / "requirements.txt")], check=True)
|
||||
|
||||
# Build CSS
|
||||
print("Building CSS with Tailwind...")
|
||||
if os.name == 'nt': # Windows
|
||||
python = venv_dir / "Scripts" / "python"
|
||||
else: # Unix-like
|
||||
python = venv_dir / "bin" / "python"
|
||||
|
||||
subprocess.run([str(python), str(website_dir / "build_css.py")], check=True)
|
||||
|
||||
print("""
|
||||
Setup completed successfully!
|
||||
|
||||
To run the development server:
|
||||
1. Activate the virtual environment:
|
||||
- Windows: .\\venv\\Scripts\\activate
|
||||
- Unix/MacOS: source venv/bin/activate
|
||||
2. Run the Flask application:
|
||||
- cd website
|
||||
- python run.py
|
||||
""")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user