-
Notifications
You must be signed in to change notification settings - Fork 0
/
colo.py
26 lines (20 loc) · 817 Bytes
/
colo.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
from flask import render_template
from chat import initChats
from chatSocket import app, sio
import user, chat, dbinterface as db, sys
# Connect other server modules (Chat.py, User.py)
app.register_blueprint(user.user)
app.register_blueprint(chat.chat)
#Following two methods return their respective HTML documents
@app.route('/chat')
def serverChat():
return render_template("chat.html")
@app.route('/')
def serverHome():
return render_template("index.html")
#This is basically the "main()" or entry point of the server
if __name__ == "__main__":
db.initDB() # <- Initialize the sqlite database
initChats() # <- Initialize the chat rooms from the database
#Entry point for the socket server and HTML server
sio.run(app, host='0.0.0.0', port = 5000, debug=True)