diff --git a/.cnb.yml b/.cnb.yml index 33bb639..ba1f545 100644 --- a/.cnb.yml +++ b/.cnb.yml @@ -1,10 +1,8 @@ -main: - push: - - services: - - docker - stages: - # 同名镜像构建&推送 - - name: docker build - script: docker build -t ${CNB_DOCKER_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}:latest . - - name: docker push - script: docker push ${CNB_DOCKER_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}:latest +$: + vscode: + - docker: + # 指定云原生开发启动时的基础镜像为当前镜像 + image: docker.cnb.cool/dockermen/tenantdrive + services: + - vscode + - docker \ No newline at end of file diff --git a/dockerfile b/dockerfile index cee9d0d..a7f7e21 100644 --- a/dockerfile +++ b/dockerfile @@ -1,5 +1,5 @@ # .ide/Dockerfile -FROM python:3.8 +FROM python:3.13 # 安装 code-server 和扩展(使用 id 安装 python 扩展,使用 vsix 安装包安装 pylance 扩展) RUN curl -fsSL https://code-server.dev/install.sh | sh \ diff --git a/index.html b/index.html new file mode 100644 index 0000000..0abcdf4 --- /dev/null +++ b/index.html @@ -0,0 +1,8 @@ + + + Hello World + + +

Hello World

+ + \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..3c5a423 --- /dev/null +++ b/main.py @@ -0,0 +1,21 @@ +import os +import requests +from flask import Flask, render_template, request, redirect, url_for, session + +app = Flask(__name__) +app.secret_key = os.urandom(24) +app.config["SESSION_TYPE"] = "filesystem" +app.config["SESSION_FILE_DIR"] = "./.flask_session/" +app.config["SESSION_PERMANENT"] = False +app.config["SESSION_COOKIE_NAME"] = "login" +app.config["SESSION_COOKIE_HTTPONLY"] = True +app.config["SESSION_COOKIE_SECURE"] = False + + +@app.route("/", methods=["GET", "POST"]) +def index(): + if request.method == "POST": + session["username"] = request.form["username"] + session["password"] = request.form["password"] + return redirect(url_for("home")) + return render_template("index.html") \ No newline at end of file