Răsfoiți Sursa

Merge branch 'hugo-vetev'

Adam Dominec 5 zile în urmă
părinte
comite
5610756170
5 a modificat fișierele cu 3 adăugiri și 51 ștergeri
  1. 0 35
      app/__init__.py
  2. 2 0
      app/app.py
  3. 0 7
      app/home.py
  4. 0 8
      app/questions.py
  5. 1 1
      app/templates/home.html

+ 0 - 35
app/__init__.py

@@ -1,35 +0,0 @@
-import os
-
-from flask import Flask
-
-
-def create_app(test_config=None):
-    # create and configure the app
-    app = Flask(__name__, instance_relative_config=True)
-    app.config.from_mapping(
-        SECRET_KEY="dev",
-        DATABASE=os.path.join(app.instance_path, "flaskr.sqlite"),
-    )
-
-    if test_config is None:
-        # load the instance config, if it exists, when not testing
-        app.config.from_pyfile("config.py", silent=True)
-    else:
-        # load the test config if passed in
-        app.config.from_mapping(test_config)
-
-    # ensure the instance folder exists
-    os.makedirs(app.instance_path, exist_ok=True)
-
-    # a simple page that says hello
-    @app.route("/health")
-    def health():
-        return "Health check passed!"
-
-    from . import home
-    app.register_blueprint(home.bp, url_prefix="/")
-
-    from . import questions
-    app.register_blueprint(questions.bp, url_prefix="/api/questions")
-
-    return app

+ 2 - 0
b end.py → app/app.py

@@ -13,3 +13,5 @@ def health():
 @app.route("/api/questions/")
 def questions_index():
     return "Hello, World!"
+
+app.run(port=5000)

+ 0 - 7
app/home.py

@@ -1,7 +0,0 @@
-from flask import Blueprint, render_template
-
-bp = Blueprint("home", __name__)
-
-@bp.route("/")
-def index():
-    return render_template("home.html")

+ 0 - 8
app/questions.py

@@ -1,8 +0,0 @@
-from flask import Blueprint
-
-bp = Blueprint("questions", __name__)
-
-
-@bp.route("/")
-def index():
-    return "Hello, World!"

+ 1 - 1
app/templates/home.html

@@ -20,7 +20,7 @@
     <div >
     <h1>silly_qiz</h1>
     <h3 class="rainbow">toto bude mega giga silly qiz, aby jste mohli zjistit který z učítelů gimjs jste :3</h3>
-        <a href="{{ url_for('questions.index') }}">Začít kvíz</a>
+        <a href="{{ url_for('index') }}">Začít kvíz</a>
     </div>
 </div>
 </template>