-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
49 lines (43 loc) · 1.29 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from flask import Flask
from flask_cors import CORS
from flask_restful import Api
from gh_gradingservice import GradingService
from mdl_assignmentservice import MdlAssignmentService
from logging.config import dictConfig
app = Flask(__name__)
CORS(app)
app.config.from_pyfile('./.env')
dictConfig(
{
"version": 1,
"formatters": {
"default": {
"format": "[%(asctime)s] %(levelname)s in %(module)s: %(message)s",
}
},
"handlers": {
"console": {
"class": "logging.StreamHandler",
"stream": "ext://sys.stdout",
"formatter": "default",
},
"file": {
"class": "logging.FileHandler",
"filename": app.config['LOG_FILE'],
"formatter": "default",
},
},
"root": {
"level": app.config['LOG_LEVEL'],
"handlers": ["console", "file"]
},
}
)
api = Api(app)
api.add_resource(GradingService, '/gh_grade/<owner>/<repo>/<points>/<max>')
api.add_resource(MdlAssignmentService, '/mdl_assign/<actor>/<repo>/<assignid>/<courseid>/<userid>', '/db_show')
@app.route('/')
def hello_world(): # put application's code here
return ''
if __name__ == '__main__':
app.run()