-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
25 lines (20 loc) · 845 Bytes
/
main.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
from flask import Flask
from mongoengine import connect
from flask import session
import os
DB_NAME="Blog_DB" #database name
app=Flask(__name__)
app.secret_key="sessionkey" # for sessions
app.config['SECRET_KEY'] ="BLOGWebsite"
try:
#db=connect(DB_NAME,host="mongodb://localhost:27017") # initializing the MongoDB with the flask application(app).
db=connect(DB_NAME,host="mongodb://mongo:[email protected]:6304")
except ConnectionError as e:
print("Error while connecting to the Database : "+e)
from views import views
from auth import auth
app.register_blueprint(views,url_prefix="/")
app.register_blueprint(auth,url_prefix="/")
if __name__=="__main__":
app.run(debug=True,host='0.0.0.0',port=os.getenv("PORT", default=5000))
# app.run(host='0.0.0.0') # experiment