A system for students in program design course to share their code with TAs.
Python >= 3.10
Node JS >= 18
Because the frontend part and backend part is independent, you may need some additional software(etc. Nginx, Apache) to combine it together.
In addition, the config of database(MongoDB are used in this project) is not included in this document, you will need to set up and config it yourself.
All operations are in the
backend
directory.
Create virtual environment:
python3 -m venv .venv
Enter virtual environment(Windows):
.\.venv\Scripts\activate
Enter virtual environment(MacOS/Unix):
source .venv/bin/activate
pip3 install -r requirements.txt
It will auto generate a new config file and exit.
python3 main.py
See Config Document for more information.
python3 main.py
All operations are in the
frontend
directory.
npm install
See Config Document for more information.
npm build
Copy the build
to your reverse proxy's path.
Example Config:
{
"host": "0.0.0.0",
"port": 8080,
"worker": 1,
"process_count": 6,
"root_path": "",
"key": "601d4c0a0c2ba32fe3f8d087475657a6",
"data_dir": "data",
"single_file_size": 1048576,
"discord_config": {
"redirect_uri": "https://example.com/login",
"client_id": "0000000000",
"client_secret": "your-client-secret",
"admins": [
"302774180611358720",
]
},
"mongodb_config": {
"url": "mongodb://db_username:[email protected]:27017/db_table",
"name": "table_name"
},
"ssh_config": {
"host": "172.16.0.2",
"port": 22
}
}
-
host
: API binding address, default is0.0.0.0
. -
port
: API binding port, default is8080
. -
workers
Uvicorn workers count, default is1
. -
process_count
How many process will start, default is your cpu's cores count. (⚠ The more process start, more ports will be used, be careful about that there is no other application occpuy the port in the range. For example, you set the port8080
and process count6
, it will use the port in8080~8085
.) -
root_path
: FastAPI's root path, be used for Open API's document. -
key
: Key for the JWT, it will auto generate when you first start up. -
data_dir
: The directory path for saving the ticket file upload by user. -
single_file_size
: The size limit for every file, default is1048576
(1MB). -
discord_config
: See Discord Config Part -
mongodb_config
: See MongoDB Config Part -
ssh_config
: See SSH Config Part
-
redirect_uri
: The redirect uri you set in discord's developer portal. -
client_id
: The client id you get in discord's developer portal. -
client_secret
The client secret you get in discord's developer portal. -
admins
: The list of admin's discord user id.
-
url
: The MongoDB's connect url. -
name
: Your table's name, default ispd2-ticket
.
This feature is still develope.
-
host
: The SSH server's address. -
port
: The SSH server's port, default is22
.
Example Config:
REACT_APP_UI_VERSION=v2.0.0
REACT_APP_API_END_POINT=/api/v1
REACT_APP_OAUTH_URL=https://discord.com/oauth2/authorize?client_id=000000&response_type=code&redirect_uri=https://example.com/login&scope=identify
-
REACT_APP_UI_VERSION
(You doesn't need to modify this value): The ui version display on web. -
REACT_APP_API_END_POINT
: The API's endpoint. -
REACT_APP_OAUTH_URL
: The url link to discord oauth.