Operational Notes and Troubleshooting
Keep your development environment healthy and your API running smoothly. This section lists common issues and checks to diagnose and resolve them quickly.
🔧 Missing Dependencies
Ensure all required packages are installed in the correct environment.
| Package | Install Command |
|---|---|
| Flask | pip install Flask |
| Flask-RESTful | pip install Flask-RESTful |
| Flask-JWT | pip install Flask-JWT |
| Flask-SQLAlchemy | pip install Flask-SQLALCHEMY |
Steps to verify:
- Activate your virtual environment before installing .
- Run
pip listto confirm packages are present. - If you still see an
ImportError, reinstall dependencies with:
or individually as needed.pip install -r requirements.txt
{
"title": "Activate Venv",
"content": "Always activate your virtual environment before installing dependencies."
}
🐍 Wrong Python Version
The project targets Python 3.8. Running it on a substantially different version may cause compatibility issues, especially with older Flask-JWT releases .
- Verify your interpreter:
python --version - If needed, create a new virtual environment with Python 3.8:
virtualenv venv --python=python3.8
💾 Database Not Updating
If your POST/PUT/DELETE requests appear successful but the database does not change, check the following:
- Debug Mode
Ensure the app runs with debug enabled for full error output :if __name__ == '__main__': db.init_app(app) app.run(port=5000, debug=True) - Correct Base URL
Send requests tohttp://localhost:5000/...(or your configured host and port). - Commit Calls
Confirmsave_to_dbanddelete_from_dbinvokedb.session.commit():def save_to_db(self): db.session.add(self) db.session.commit() def delete_from_db(self): db.session.delete(self) db.session.commit() - Server Logs
Inspect console output for swallowed exceptions or SQL errors.
🔐 JWT Token Not Set in Postman
Protected endpoints require a valid JWT. If you receive 401 Unauthorized, follow these checks:
- Run
/authFirst
Authenticate and obtain a token via the Postman/authrequest. - Test Script Enabled
Verify the test script savesaccess_tokentojwt_token:pm.test("JWT Token Not Empty", function () { var jsonData = pm.response.json(); pm.globals.set("jwt_token", jsonData.access_token); }); - Correct Header
Use the variable in subsequent requests:Authorization: JWT {{jwt_token}} - Order of Requests
Ensure/authruns and passes before any protected call.
Stay proactive: monitor logs, keep dependencies current, and verify environment settings. Happy coding!