@@ -11,6 +11,22 @@ This application is a simple student management API built using Python's Flask f
1111
1212- Install WSL (` wsl --install ` ) for <img src =" https://keploy.io/docs/img/os/windows.png " alt =" Windows " width =" 3% " /> Windows.
1313
14+ ### Windows (PowerShell) Notes 🪟
15+
16+ If you are using Windows with PowerShell, some Linux/macOS commands in this guide may not work directly.
17+
18+ - If you are using a Python virtual environment, activate it using:
19+ ``` powershell
20+ .\venv\Scripts\Activate.ps1
21+ ```
22+
23+ Install dependencies using 'pip' (instead of 'pip3'):
24+
25+ ``` powershell
26+ pip install -r requirements.txt
27+ ```
28+
29+ If you encounter script execution errors, ensure that PowerShell execution policy allows running local scripts.
1430#### Optional 🛠️
1531
1632- Install Colima( ` brew install colima && colima start ` ) for <img src =" https://keploy.io/docs/img/os/macos.png " alt =" MacOS " width =" 3% " /> MacOs.
@@ -39,11 +55,46 @@ Start the MongoDB instance-
3955docker run -p 27017:27017 -d --network backend --name mongo mongo
4056```
4157
58+ ### Using MongoDB Atlas (Optional) ☁️
59+
60+ Instead of running MongoDB locally or via Docker, you can also use ** MongoDB Atlas** , a free cloud-hosted MongoDB service.
61+
62+ If you are using MongoDB Atlas:
63+
64+ 1 . Create a free cluster on MongoDB Atlas.
65+ 2 . Obtain the connection string (SRV format), for example:
66+
67+ ```
68+ mongodb+srv://<username>:<password>@cluster0.mongodb.net/studentsdb
69+ ```
70+
71+ 3 . Install the required SRV dependency:
72+ ``` bash
73+ pip install " pymongo[srv]"
74+ ```
75+
76+ Replace the MongoDB connection URL in the application with your Atlas connection string.
77+
78+ ⚠️ ** Important Note on MongoDB Passwords**
79+
80+ If your MongoDB password contains special characters such as @, :, /, or #, the connection string may fail with an InvalidURI error.
81+
82+ To avoid this:
83+
84+ - Use alphanumeric passwords, or
85+ - URL-encode the password before adding it to the connection string (for example, using ` urllib.parse.quote_plus ` in Python).
86+
4287## Clone a simple Student Management API 🧪
4388
4489``` bash
4590git clone https://github.com/keploy/samples-python.git && cd samples-python/flask-mongo
91+
92+ # For Linux/WSL users:
4693pip3 install -r requirements.txt
94+
95+ # For Windows (PowerShell) users:
96+ # .\venv\Scripts\Activate.ps1 <-- Activate your virtual environment first
97+ pip install -r requirements.txt
4798```
4899
49100## Installation 📥
@@ -62,10 +113,22 @@ pip3 install -r requirements.txt
62113 keploy record -c " docker run -p 6000:6000 --name flask-app --network backend flask-app:1.0"
63114 ```
64115
65- 🔥** Make some API calls** . Postman, Hoppscotch or even curl - take your pick!
116+ 🔥 ** Make some API calls. ** Postman, Hoppscotch or even curl - take your pick!
66117
67118 Let's make URLs short and sweet:
68119
120+ ### Port Configuration Note ⚙️
121+
122+ The application commonly runs on port ` 6000 ` , but if that port is already in use, Flask may automatically switch to another available port.
123+
124+ Always check the terminal output for a line similar to:
125+
126+ ```
127+ Running on http://127.0.0.1:<port>
128+ ```
129+
130+ Use the displayed port number when making API calls with ` curl ` , Postman, or other tools.
131+
69132 ### Generate testcases
70133
71134 To generate testcases we just need to ** make some API calls.**
@@ -227,6 +290,11 @@ pip3 install -r requirements.txt
227290 Install the dependencies :
228291
229292 ` ` ` bash
293+ # For Linux/WSL:
294+ pip3 install -r requirements.txt
295+
296+ # For Windows (PowerShell):
297+ .\v env\S cripts\A ctivate.ps1
230298 pip install -r requirements.txt
231299 ` ` `
232300
0 commit comments