From 3e482d2e4999a159c9160c4391498068ce751f15 Mon Sep 17 00:00:00 2001 From: Jan Dickmann Date: Sun, 30 Jun 2024 12:40:39 +0200 Subject: [PATCH] dockerfile, fixing hardcoded url and cleanup --- slaeforms/app.py | 5 +- slaeforms/dockerfile | 17 ++ slaeforms/requirements.txt | 16 + slaeforms/templates/layout2.html | 126 ++++---- slaeforms/templates/login.html | 2 +- .../{ => old_unused}/myvideotemplate.html | 282 +++++++++--------- slaeforms/templates/popuptest.html | 2 +- slaeforms/templates/standard_template.html | 2 +- slaeforms/templates/startpage.html | 2 +- slaeforms/templates/test_page0.html | 20 -- slaeforms/templates/test_page1.html | 25 -- slaeforms/templates/teststartpage.html | 2 +- 12 files changed, 246 insertions(+), 255 deletions(-) create mode 100644 slaeforms/dockerfile create mode 100644 slaeforms/requirements.txt rename slaeforms/templates/{ => old_unused}/myvideotemplate.html (97%) delete mode 100644 slaeforms/templates/test_page0.html delete mode 100644 slaeforms/templates/test_page1.html diff --git a/slaeforms/app.py b/slaeforms/app.py index a02f65c..034256e 100644 --- a/slaeforms/app.py +++ b/slaeforms/app.py @@ -657,5 +657,8 @@ def delete_all_entries(): # Close the session db.session.close() +def create_app(): + return app + if __name__ == '__main__': - app.run() \ No newline at end of file + app.run() diff --git a/slaeforms/dockerfile b/slaeforms/dockerfile new file mode 100644 index 0000000..a3153c4 --- /dev/null +++ b/slaeforms/dockerfile @@ -0,0 +1,17 @@ +# Use the official Python image from the Docker Hub +FROM python:3.10-slim + +# Set the working directory +WORKDIR /slaeforms + +# Copy the rest of the application code to the working directory +COPY . . + +# Install the dependencies +RUN pip install --no-cache-dir -r requirements.txt + +# Expose the port on which the app will run +EXPOSE 8000 + +# Define the command to run the application using Gunicorn +CMD ["gunicorn", "--bind", "0.0.0.0:8000", "app:create_app()"] \ No newline at end of file diff --git a/slaeforms/requirements.txt b/slaeforms/requirements.txt new file mode 100644 index 0000000..457a64d --- /dev/null +++ b/slaeforms/requirements.txt @@ -0,0 +1,16 @@ +blinker==1.8.2 +click==8.1.7 +colorama==0.4.6 +Flask==3.0.3 +Flask-SQLAlchemy==3.1.1 +Flask-WTF==1.2.1 +greenlet==3.0.3 +gunicorn==22.0.0 +itsdangerous==2.2.0 +Jinja2==3.1.4 +MarkupSafe==2.1.5 +packaging==24.1 +SQLAlchemy==2.0.30 +typing_extensions==4.12.2 +Werkzeug==3.0.3 +WTForms==3.1.2 diff --git a/slaeforms/templates/layout2.html b/slaeforms/templates/layout2.html index f3154dc..d73ce1a 100644 --- a/slaeforms/templates/layout2.html +++ b/slaeforms/templates/layout2.html @@ -1,64 +1,64 @@ - - - - - - - Testform - - - - -

Question: {{ current_question }}

- {% if (videotype == "single")%} -
-

Video 1

- -
- {% elif (videotype == "pairwise")%} -
-
-

Video 1

- -
-
-

Video 2

- -
-
- - {% else %} -

Error: No Videotype could be matched or was given!

- {% endif %} -
- {% for block in config["question 1"]["blocks"] %} - {% if (config["question 1"]["blocks"][block]["type"] == "likert") %} -
-
- - - - - -
-
- {% elif (config["question 1"]["blocks"][block]["type"] == "textinput") %} - - - {% else %} -

Error: A block could not be loaded!

- {% endif %} - {% endfor %} -

-
- - + + + + + + + Testform + + + + +

Question: {{ current_question }}

+ {% if (videotype == "single")%} +
+

Video 1

+ +
+ {% elif (videotype == "pairwise")%} +
+
+

Video 1

+ +
+
+

Video 2

+ +
+
+ + {% else %} +

Error: No Videotype could be matched or was given!

+ {% endif %} +
+ {% for block in config["question 1"]["blocks"] %} + {% if (config["question 1"]["blocks"][block]["type"] == "likert") %} +
+
+ + + + + +
+
+ {% elif (config["question 1"]["blocks"][block]["type"] == "textinput") %} + + + {% else %} +

Error: A block could not be loaded!

+ {% endif %} + {% endfor %} +

+
+ + \ No newline at end of file diff --git a/slaeforms/templates/login.html b/slaeforms/templates/login.html index 6c2bf6a..6fc1cc1 100644 --- a/slaeforms/templates/login.html +++ b/slaeforms/templates/login.html @@ -12,7 +12,7 @@
diff --git a/slaeforms/templates/myvideotemplate.html b/slaeforms/templates/old_unused/myvideotemplate.html similarity index 97% rename from slaeforms/templates/myvideotemplate.html rename to slaeforms/templates/old_unused/myvideotemplate.html index 6e3cbf4..608dca2 100644 --- a/slaeforms/templates/myvideotemplate.html +++ b/slaeforms/templates/old_unused/myvideotemplate.html @@ -1,142 +1,142 @@ - - - - - - - - Testform - - - - -
-

Gib Feedback als Video

-
- - - -
- -
- - - - - -
- -
- -
- -
- - + + + + + + + + Testform + + + + +
+

Gib Feedback als Video

+
+ + + +
+ +
+ + + + + +
+ +
+ +
+ +
+ + \ No newline at end of file diff --git a/slaeforms/templates/popuptest.html b/slaeforms/templates/popuptest.html index 11920b0..176f923 100644 --- a/slaeforms/templates/popuptest.html +++ b/slaeforms/templates/popuptest.html @@ -39,7 +39,7 @@ If you have further questions, please send an email to testemail@notarealemail.deee

-
+ diff --git a/slaeforms/templates/standard_template.html b/slaeforms/templates/standard_template.html index 02c0c9c..967a75a 100644 --- a/slaeforms/templates/standard_template.html +++ b/slaeforms/templates/standard_template.html @@ -123,7 +123,7 @@ step={{question["step"]}}

Error: Block {{ stimulus["type"] }} could not be loaded!

{% endif %} - + {% for question in questions %} {% if (questions[question]["type"] == "likert") %} diff --git a/slaeforms/templates/startpage.html b/slaeforms/templates/startpage.html index 3de6867..a1c6296 100644 --- a/slaeforms/templates/startpage.html +++ b/slaeforms/templates/startpage.html @@ -10,7 +10,7 @@

Hello! Thank you for participating in our study!

- + diff --git a/slaeforms/templates/test_page0.html b/slaeforms/templates/test_page0.html deleted file mode 100644 index d8c16d6..0000000 --- a/slaeforms/templates/test_page0.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - Test Page 0 - Nothing - - - - -
-

This is just a test page for the single page option of the json configuration, but without something to submit

- - - - -
- - \ No newline at end of file diff --git a/slaeforms/templates/test_page1.html b/slaeforms/templates/test_page1.html deleted file mode 100644 index f3d4611..0000000 --- a/slaeforms/templates/test_page1.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - Test Page 1 - Datenschutzerklaerung - - - - -
-

This is just a test page for the single page option of the json configuration

-
- - -

-
-
- - \ No newline at end of file diff --git a/slaeforms/templates/teststartpage.html b/slaeforms/templates/teststartpage.html index 25eb62d..ffeba3f 100644 --- a/slaeforms/templates/teststartpage.html +++ b/slaeforms/templates/teststartpage.html @@ -32,7 +32,7 @@

-
+