-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Server: Switch from Django to Flask #48
Conversation
Updated the Pipfile to replace the Django package with Flask. This change was made to switch the web framework being used in the project.
This commit refactors the code to use flask instead of django. :)
Added Flask-SQLAlchemy and Flask-Migrate dependencies to the project to enable database functionality and migrations. Made changes to Pipfile, requirements.txt, and updated app.py to integrate these libraries.
Furthermore, this commit adds scripts for performing house keeping actions like creating migrations, applying them, etc.
Refactored register_player() function to improve error handling and return a proper HTTP 400 response when an invalid TAN is detected. The response is now created using Response directly.
- Installed Flask-WTF for CSRF protection in app.py - Integrated CSRF protection in app initialization in app.py - Removed unused function and updated requirements.txt and Pipfile configurations
Wie sieht die Trennung zwischen Flask Backend und React Frontend aus? Mmn brauchen wir dafür einen neuen Unterordner oder auf Projektebene einen neuen. Oder benutzen wir doch Jinja auf Python Basis? |
Dafür würde ich evtl einfach einen neuen Ordner "Frontend" machen, in dem das dann lebt. Oder einen |
Add scripts to build and start the frontend in the Makefile. Also updated the app.py file to serve the frontend files.
Refactored the Flask API responses in api.py to remove the unnecessary use of jsonify and streamline the return statements for better readability and consistency. Updated the get_current_exec_status and hello_world functions to return dictionaries directly instead of using jsonify. Also updated the register_player function to return the exec_id directly.
Added redirect to "/" when the path is empty in the serve function to ensure that the root path redirects to the index.html page.
Wie im Call besprochen: um eine einheitliche BE/FE Trennung hinzubekommen wäre eine Auslagerung des Fronentordners manvsim-frontend sinnvoll. Außerdem würde ich das dann auch umbenennen in web-frontend. Dann können sich die Appler später da auch einfinden und ihren Kram dazu programmieren.
|
This PR refactors the server, such that we switch from Django to Flask. All currently defined custom routes are ported. However, the django-internal routes are not ported and need to be created manually (or we find a valid substitution for them). This PR utilizes
SQLAlchemy
to create a connection with the database, together withflask_migrate
to create and manage migrations for the database scheme.Furthermore, this PR adds lifecycle and house keeping scripts for performing common tasks like setting up a workspace, starting the server, cleaning up the local files, or performing database migrations.
Closes #39