Added hotfixes
This commit is contained in:
parent
5efcfd1f3c
commit
4dea33bc7f
39
app.py
39
app.py
@ -1,3 +1,38 @@
|
|||||||
from src.app import create_app
|
from gevent import monkey
|
||||||
|
monkey.patch_all()
|
||||||
|
|
||||||
app = create_app()
|
from werkzeug.serving import run_simple
|
||||||
|
from flask_cors import CORS
|
||||||
|
from pymongo import MongoClient
|
||||||
|
|
||||||
|
from src.config import Config
|
||||||
|
from src.singletons.database_singleton import DatabaseSingleton
|
||||||
|
|
||||||
|
from src.infra.server import app, socketio
|
||||||
|
from src.controllers.user_controller import user_blueprint
|
||||||
|
from src.controllers.reservation_controller import reservation_blueprint
|
||||||
|
from src.controllers.health_controller import health_blueprint
|
||||||
|
from src.controllers.room_controller import room_blueprint
|
||||||
|
|
||||||
|
CORS(app)
|
||||||
|
app.config['JWT_SECRET_KEY'] = Config.JWT_SECRET_KEY
|
||||||
|
|
||||||
|
app.register_blueprint(user_blueprint, url_prefix='/user')
|
||||||
|
app.register_blueprint(reservation_blueprint, url_prefix='/reservation')
|
||||||
|
app.register_blueprint(room_blueprint, url_prefix='/room')
|
||||||
|
app.register_blueprint(health_blueprint, url_prefix='/health')
|
||||||
|
|
||||||
|
client = MongoClient(Config.MONGO_URI)
|
||||||
|
db = DatabaseSingleton.get_instance()
|
||||||
|
|
||||||
|
if db is not None:
|
||||||
|
print('Connected to MongoDB')
|
||||||
|
else:
|
||||||
|
print('Failed to connect to MongoDB')
|
||||||
|
|
||||||
|
def create_app():
|
||||||
|
return app
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
#app.run(debug=True)
|
||||||
|
socketio.run(app, host=Config.APP_HOST, debug=False)
|
2
run.bat
2
run.bat
@ -19,5 +19,5 @@ if exist ".env" (
|
|||||||
echo .env file not found.
|
echo .env file not found.
|
||||||
)
|
)
|
||||||
|
|
||||||
python src/app.py
|
python app.py
|
||||||
pause
|
pause
|
38
src/app.py
38
src/app.py
@ -1,38 +0,0 @@
|
|||||||
from gevent import monkey
|
|
||||||
monkey.patch_all()
|
|
||||||
|
|
||||||
from werkzeug.serving import run_simple
|
|
||||||
from flask_cors import CORS
|
|
||||||
from pymongo import MongoClient
|
|
||||||
|
|
||||||
from src.config import Config
|
|
||||||
from src.singletons.database_singleton import DatabaseSingleton
|
|
||||||
|
|
||||||
from src.infra.server import app, socketio
|
|
||||||
from src.controllers.user_controller import user_blueprint
|
|
||||||
from src.controllers.reservation_controller import reservation_blueprint
|
|
||||||
from src.controllers.health_controller import health_blueprint
|
|
||||||
from src.controllers.room_controller import room_blueprint
|
|
||||||
|
|
||||||
CORS(app)
|
|
||||||
app.config['JWT_SECRET_KEY'] = Config.JWT_SECRET_KEY
|
|
||||||
|
|
||||||
app.register_blueprint(user_blueprint, url_prefix='/user')
|
|
||||||
app.register_blueprint(reservation_blueprint, url_prefix='/reservation')
|
|
||||||
app.register_blueprint(room_blueprint, url_prefix='/room')
|
|
||||||
app.register_blueprint(health_blueprint, url_prefix='/health')
|
|
||||||
|
|
||||||
client = MongoClient(Config.MONGO_URI)
|
|
||||||
db = DatabaseSingleton.get_instance()
|
|
||||||
|
|
||||||
if db is not None:
|
|
||||||
print('Connected to MongoDB')
|
|
||||||
else:
|
|
||||||
print('Failed to connect to MongoDB')
|
|
||||||
|
|
||||||
def create_app():
|
|
||||||
return app
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
#app.run(debug=True)
|
|
||||||
socketio.run(app, host=Config.APP_HOST, debug=False)
|
|
@ -6,8 +6,8 @@ room_blueprint = Blueprint('room', __name__)
|
|||||||
#@jwt_required()
|
#@jwt_required()
|
||||||
def list_rooms():
|
def list_rooms():
|
||||||
return jsonify([
|
return jsonify([
|
||||||
{"id": "67d28e7004bda1d7130c9825", "title": "Маркетинг"},
|
|
||||||
{"id": "67d28e7004bda1d7130c9826", "title": "Green"},
|
|
||||||
{"id": "67d28e7004bda1d7130c9827", "title": "Конференц-зал"},
|
{"id": "67d28e7004bda1d7130c9827", "title": "Конференц-зал"},
|
||||||
|
{"id": "67d28e7004bda1d7130c9826", "title": "Green"},
|
||||||
|
{"id": "67d28e7004bda1d7130c9825", "title": "Маркетинг"},
|
||||||
{"id": "67d28e7004bda1d7130c9828", "title": "Dipal"}
|
{"id": "67d28e7004bda1d7130c9828", "title": "Dipal"}
|
||||||
])
|
])
|
Loading…
x
Reference in New Issue
Block a user