mirror of
				https://github.com/kevinveenbirkenbach/homepage.veen.world.git
				synced 2025-11-04 01:18:09 +00:00 
			
		
		
		
	Added correct env path import
This commit is contained in:
		
							
								
								
									
										14
									
								
								main.py
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								main.py
									
									
									
									
									
								
							@@ -22,6 +22,16 @@ import argparse
 | 
			
		||||
import subprocess
 | 
			
		||||
import sys
 | 
			
		||||
import os
 | 
			
		||||
from dotenv import load_dotenv
 | 
			
		||||
from pathlib import Path
 | 
			
		||||
 | 
			
		||||
# Always load .env from the script's directory
 | 
			
		||||
dotenv_path = Path(__file__).resolve().parent / ".env"
 | 
			
		||||
 | 
			
		||||
if dotenv_path.exists():
 | 
			
		||||
    load_dotenv(dotenv_path)
 | 
			
		||||
else:
 | 
			
		||||
    print(f"⚠️  Warning: No .env file found at {dotenv_path}")
 | 
			
		||||
PORT = int(os.getenv("PORT", 5000))
 | 
			
		||||
 | 
			
		||||
def run_command(command, dry_run=False):
 | 
			
		||||
@@ -195,7 +205,7 @@ def browse(args):
 | 
			
		||||
 | 
			
		||||
    This command launches the Chromium browser to view the running application.
 | 
			
		||||
    """
 | 
			
		||||
    command = ["chromium", "http://localhost:5000"]
 | 
			
		||||
    command = ["chromium", f"http://localhost:{PORT}"]
 | 
			
		||||
    run_command(command, args.dry_run)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -223,7 +233,7 @@ def main():
 | 
			
		||||
 | 
			
		||||
    # Browse command
 | 
			
		||||
    parser_browse = subparsers.add_parser(
 | 
			
		||||
        "browse", help="Open http://localhost:5000 in Chromium browser."
 | 
			
		||||
        "browse", help="Open application in Chromium browser."
 | 
			
		||||
    )
 | 
			
		||||
    parser_browse.set_defaults(func=browse)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								requirements.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								requirements.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
python-dotenv
 | 
			
		||||
		Reference in New Issue
	
	Block a user