The KomodoHub backend is built with Python 3.8, Flask, uWSGI, and MySQL. Follow the steps below to set up and run the server:
-
Ensure you're using Python 3.8.
-
Navigate to the
./backend/directory.cd ./backend/ -
Install the required dependencies:
pip install -r requirements.txt
(Make sure to update the
requirements.txtwith any new libraries and versions when adding dependencies). -
Ensure the MySQL database exists. If not, create it by running the following command in the MySQL client:
CREATE DATABASE if not exists komodo_hub CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
-
For development purposes, run the application using:
python app.py
-
For production, run the application with uWSGI:
uwsgi --ini uwsgi.ini
app.py: The main application file where the Flask app is initialized.config.py: Contains all configuration settings for the app, including the database URI and secret keys.models.py: Defines the database schema (tables and relationships).routes.py: Contains all the route definitions for the RESTful API.uwsgi.ini: Configuration for uWSGI to serve the app in production.wsgi.py: Entry point for the uWSGI server to run the Flask app.requirements.txt: Lists all the Python dependencies required for the project.
Note:
The init.sql file (located in the root directory) contains the full database schema with English comments.
It serves as a reference structure and can be adapted based on business requirements.
Tables may be added, modified, or removed as needed.
- Register interface case
curl --request POST \ --url http://localhost:9898/register \ --header 'Content-Type: application/json' \ --data '{ "username": "alice123", "password": "securepassword", "email": "[email protected]", "role": "STUDENT", "full_name": "Alice Zhang", "age": 25, "gender": "F", "bio": "AI lover and Python developer.", "avatar_url": "https://example.com/avatar.jpg" }'
This update adds a complete role-based registration experience to the KomodoHub platform.
- Email, password, and confirm password input fields
- Role selection dropdown (User/Admin)
- Privacy policy agreement checkbox (must be checked to register)
- Real-time input validation and friendly error messages
- Vue 3 with
<script setup> - Tailwind CSS for styling
- Vite + TypeScript
- Git for version control (branch:
Register_Page)
The system has been deployed via Vercel to test the registration UI:
Live Demo
Contributed by weix20