#!/usr/bin/env python3 """ Simple HTTP server to serve SPA test page on port 3000 This simulates a Nuxt/Next.js frontend """ import http.server import socketserver import os from urllib.parse import urlparse, parse_qs import json PORT = 3001 # Using 3001 since 3000 might be in use class SPAHandler(http.server.SimpleHTTPRequestHandler): def do_GET(self): # Parse URL parsed = urlparse(self.path) path = parsed.path # Serve activation page if path.startswith('/activate/'): parts = path.split('/') if len(parts) >= 4: uid = parts[2] token = parts[3] self.serve_activation_page(uid, token) return # Serve main SPA page if path == '/' or path == '/index.html': self.serve_spa_page() return # Default handler super().do_GET() def serve_spa_page(self): """Serve the main SPA page""" html = """ Frontend SPA (Port 3000)

🎉 Frontend SPA (Port 3000)

Bu sayfa Nuxt/Next.js frontend'inizi simüle ediyor.

✅ Email activation linkleri buraya gelecek!

Format: http://localhost:3000/activate/{uid}/{token}/

Test için:

Backend SPA Test (Port 8000)

""" self.send_response(200) self.send_header('Content-type', 'text/html') self.end_headers() self.wfile.write(html.encode()) def serve_activation_page(self, uid, token): """Serve activation page that calls Django API""" html = f""" Activating Account...

Activating Your Account...

Please wait...

Account Activated!

Your account has been successfully activated.

Go to Login

Activation Failed

Something went wrong.

Back to Login
""" self.send_response(200) self.send_header('Content-type', 'text/html') self.end_headers() self.wfile.write(html.encode()) os.chdir('/home/beyhan/Python/server') with socketserver.TCPServer(("", PORT), SPAHandler) as httpd: print(f"🚀 Frontend SPA Server running on http://localhost:{PORT}") print(f"📧 Email activation links will work here!") print(f"🔗 Open: http://localhost:{PORT}") print(f"\nPress Ctrl+C to stop") httpd.serve_forever()