-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
22 lines (17 loc) · 720 Bytes
/
Copy pathapp.py
File metadata and controls
22 lines (17 loc) · 720 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from flask import Flask
from pymongo import MongoClient
from flask_session import Session
app = Flask(__name__)
app.secret_key = "your_secret_key" # Remplacez par une clé sécurisée
# Configuration pour utiliser MongoDB pour les sessions
app.config['SESSION_TYPE'] = 'mongodb'
app.config['SESSION_MONGODB'] = MongoClient("mongodb://localhost:27017/")
app.config['SESSION_MONGODB_DB'] = 'mydb'
app.config['SESSION_MONGODB_COLLECTION'] = 'sessions'
# Connexion à MongoDB
client = MongoClient("mongodb://localhost:27017/")
db = client.mydb
users_collection = db["User"]
# Initialisation de la session
Session(app)
from routes_login import * # Assurez-vous que routes est importé après l'initialisation de l'app