From 3df4c70387ffa25b353406403ada5f3bd5052296 Mon Sep 17 00:00:00 2001 From: Nyx Tutt Date: Sun, 9 Mar 2025 12:57:29 -0500 Subject: [PATCH] first code --- app/app.py | 24 ++++++++++++++++++++++++ app/templates/header.j2 | 7 +++++++ app/templates/index.j2 | 22 ++++++++++++++++++++++ app/templates/login.j2 | 26 ++++++++++++++++++++++++++ requirements.txt | 1 + 5 files changed, 80 insertions(+) create mode 100644 app/templates/header.j2 create mode 100644 app/templates/index.j2 create mode 100644 app/templates/login.j2 diff --git a/app/app.py b/app/app.py index e69de29..1d3c17a 100644 --- a/app/app.py +++ b/app/app.py @@ -0,0 +1,24 @@ +from flask import * +from os import path, walk + +app = Flask(__name__) + +@app.route('/') +def home(): + return render_template('index.j2', instanceName="nyxask.nixos.internal") + +@app.route('/auth/login/') +def login(): + return render_template('login.j2', instanceName="nyxask.nixos.internal") + +extra_dirs = ['app/templates',] +extra_files = extra_dirs[:] +for extra_dir in extra_dirs: + for dirname, dirs, files in walk(extra_dir): + for filename in files: + filename = path.join(dirname, filename) + if path.isfile(filename): + extra_files.append(filename) + +if __name__ == '__main__': + app.run(debug=True, extra_files=extra_files) diff --git a/app/templates/header.j2 b/app/templates/header.j2 new file mode 100644 index 0000000..64aaa7d --- /dev/null +++ b/app/templates/header.j2 @@ -0,0 +1,7 @@ +{% macro header_home() %} +
Home
Login Register
+{% endmacro %} + +{% macro header_login() %} +
Home
Login
+{% endmacro %} diff --git a/app/templates/index.j2 b/app/templates/index.j2 new file mode 100644 index 0000000..e289962 --- /dev/null +++ b/app/templates/index.j2 @@ -0,0 +1,22 @@ +{% from 'header.j2' import header_home %} + + + + + {{ header_home() }} +
+

+ Hi from {{ instanceName }}'s Nyxask! +

+ + +
+ + +
+ + diff --git a/app/templates/login.j2 b/app/templates/login.j2 new file mode 100644 index 0000000..540aca5 --- /dev/null +++ b/app/templates/login.j2 @@ -0,0 +1,26 @@ +{% from 'header.j2' import header_login %} + + + + + {{ header_login() }} +
+

+ Login to {{ instanceName }}'s Nyxask! +

+ + +
+ + +
+ + diff --git a/requirements.txt b/requirements.txt index e69de29..7e10602 100644 --- a/requirements.txt +++ b/requirements.txt @@ -0,0 +1 @@ +flask