From 2c47a91eb9671d1cc184d449c3a9aef29998f971 Mon Sep 17 00:00:00 2001 From: majiayu000 <1835304752@qq.com> Date: Wed, 31 Dec 2025 08:20:25 +0800 Subject: [PATCH] fix: fix 'Open in Browser' button redirecting to empty page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added VS Code port forwarding settings to IDE configurations: - remote.localPortHost: localhost - remote.autoForwardPorts: true - remote.autoForwardPortsSource: process - remote.portsAttributes for common ports (3000, 5000, 8000) - Added default home route to Flask template with render_template - Created welcome page in Flask index.html template This fixes the issue where clicking 'Open in Browser' in the code-server popup would redirect to an empty page. The fix configures proper port forwarding behavior and ensures Flask has a default route to display. Fixes #54 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 Signed-off-by: majiayu000 <1835304752@qq.com> --- ide/node/settings.json | 17 ++++++ ide/python/settings.json | 17 ++++++ workspace-service/templates/flask/app.py | 6 +- .../templates/flask/templates/index.html | 59 +++++++++++++++++++ 4 files changed, 98 insertions(+), 1 deletion(-) diff --git a/ide/node/settings.json b/ide/node/settings.json index ad22f87f..81e2d6c3 100644 --- a/ide/node/settings.json +++ b/ide/node/settings.json @@ -9,6 +9,23 @@ "terminal.integrated.fontWeight": "normal", "terminal.integrated.hideOnStartup": "never", "workbench.startupEditor": "terminal", + "remote.localPortHost": "localhost", + "remote.autoForwardPorts": true, + "remote.autoForwardPortsSource": "process", + "remote.portsAttributes": { + "5000": { + "label": "Backend Server", + "onAutoForward": "openBrowserOnce" + }, + "3000": { + "label": "Frontend Server", + "onAutoForward": "openBrowserOnce" + }, + "8000": { + "label": "Dev Server", + "onAutoForward": "openBrowserOnce" + } + }, "workbench.colorCustomizations": { "sideBar.background": "#131315", "sideBarSectionHeader.background": "#131315", diff --git a/ide/python/settings.json b/ide/python/settings.json index ad22f87f..81e2d6c3 100644 --- a/ide/python/settings.json +++ b/ide/python/settings.json @@ -9,6 +9,23 @@ "terminal.integrated.fontWeight": "normal", "terminal.integrated.hideOnStartup": "never", "workbench.startupEditor": "terminal", + "remote.localPortHost": "localhost", + "remote.autoForwardPorts": true, + "remote.autoForwardPortsSource": "process", + "remote.portsAttributes": { + "5000": { + "label": "Backend Server", + "onAutoForward": "openBrowserOnce" + }, + "3000": { + "label": "Frontend Server", + "onAutoForward": "openBrowserOnce" + }, + "8000": { + "label": "Dev Server", + "onAutoForward": "openBrowserOnce" + } + }, "workbench.colorCustomizations": { "sideBar.background": "#131315", "sideBarSectionHeader.background": "#131315", diff --git a/workspace-service/templates/flask/app.py b/workspace-service/templates/flask/app.py index e374bb0f..20cf5814 100644 --- a/workspace-service/templates/flask/app.py +++ b/workspace-service/templates/flask/app.py @@ -1,6 +1,6 @@ # This should be the only entry point of the application import os -from flask import Flask +from flask import Flask, render_template from logging.config import dictConfig from models import db from flask_migrate import Migrate @@ -35,6 +35,10 @@ # Add Code Here +@app.route('/') +def home(): + """Default home route.""" + return render_template('index.html') # Run the application diff --git a/workspace-service/templates/flask/templates/index.html b/workspace-service/templates/flask/templates/index.html index e69de29b..45707adb 100644 --- a/workspace-service/templates/flask/templates/index.html +++ b/workspace-service/templates/flask/templates/index.html @@ -0,0 +1,59 @@ + + + + + + SuperCoder Flask App + + + +
+

Flask Server Running

+

Your Flask application is running successfully. Start building your backend by adding routes and logic to app.py.

+
+ + Server is running on port 5000 +
+
+ +