Server search


Neues Mitglied
I need for a school project an Server where I can have an Python backend for my Website(html, JavaScript, CSS). Does anybody know a Server for that purpose?
You can use Flask for your purpose. Install it with pip install -U Flask.

The following skeleton can be used as template to host the website from a local storage:

import os
import shutil
import random
from flask import Flask, request, jsonify, send_from_directory, make_response
from werkzeug.exceptions import BadRequest

app = Flask(__name__)
app.config["APP_WEB_STATIC_PATH"] = os.path.normpath(os.getcwd())

def handle_generic_exception(e: Exception):
    return str(e), 500

def handle_generic_exception(e: BadRequest):
    return str(e), 400

def rename():
    itemx = ["Hello", "World"]
    return jsonify(itemx)

@app.route("/submit", methods=["POST"])
def upload():
    return make_response(str(request.form) + "\r\nOK")

@app.route("/", defaults={"path": "index.html"})
def default(path):
    return send_from_directory(app.config["APP_WEB_STATIC_PATH"], path)

if __name__ == "__main__":
Oben Unten