Skip to content

Commit

Permalink
fix continue
Browse files Browse the repository at this point in the history
  • Loading branch information
VLADISLAV.BOBKOV committed Dec 7, 2024
1 parent e729816 commit ebe7323
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 17 deletions.
2 changes: 1 addition & 1 deletion backend/app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

class Config:
SECRET_KEY = os.getenv("SECRET_KEY", "supersecret")
MONGO_URI = os.getenv("MONGO_URI", "mongodb://mongo:27017/mydatabase")
MONGO_URI = os.getenv("MONGO_URI", "mongodb://mongo:27017/credit_database")
20 changes: 14 additions & 6 deletions backend/app/main.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
from flask import Flask
from flask_cors import CORS
from mongoengine import connect
# from routes import auth_routes_bp
# from routes import request_routes_bp
from mongoengine import connect, disconnect
import os
from config import Config
from routes.auth_routes import bp as auth_routes_bp
from routes.request_routes import bp as request_routes_bp
from routes.filter import bp as filter_routes_bp
from routes.profile import bp as profile_routes
from routes.statistic import bp as statistic_routes

app = Flask(__name__)
app.config.from_object(Config) # Загружаем конфигурацию из класса Config
CORS(app)

# Подключение к MongoDB
connect('credit_database')
# Отключаем предыдущее соединение (если оно существует)
disconnect()

# Подключение к MongoDB с использованием MONGO_URI из конфигурации
connect(host=app.config['MONGO_URI'])

app.register_blueprint(auth_routes_bp)
app.register_blueprint(request_routes_bp)
Expand All @@ -22,4 +26,8 @@
app.register_blueprint(statistic_routes)

if __name__ == '__main__':
app.run(debug=True)
app.run(host='0.0.0.0', debug=True)

class Config:
SECRET_KEY = os.getenv("SECRET_KEY", "supersecret")
MONGO_URI = os.getenv("MONGO_URI", "mongodb://mongo:27017/credit_database")
22 changes: 12 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
version: '3'

services:
mongo:
image: mongodb/mongodb-community-server:7.0.0-ubi8
volumes:
- mongo_data:/data/db
networks:
- default

backend:
container_name: backend
build: ./backend
ports:
- "127.0.0.1:5000:5000"
- "5000:5000"
environment:
- MONGO_URI=mongodb://mongo:27017/credit_database
depends_on:
- mongo
networks:
- default

frontend:
container_name: frontend
build: ./frontend
ports:
- "8080:8080"
networks:
- app_network
- default
depends_on:
- backend

mongo:
image: mongodb/mongodb-community-server:7.0.0-ubi8
volumes:
- mongo_data:/data/db
networks:
- app_network

volumes:
mongo_data:

networks:
app_network:
default:
driver: bridge

0 comments on commit ebe7323

Please sign in to comment.