Repository navigation
[GSSoC'26] : Fixed-Backend-Issues - #819
janmejay1438 wants to merge 2 commits into
Conversation
✅ Deploy Preview for bibliodrift-dm ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
This PR is definitely addressing problems but it is a problem in itself too because the scope became too broad. lol. Some of the import cleanup changes make sense ( A few concerns:
|
|
@Wahid7852, Appreciate your concern. I had concern myself. But my sole goal upon working on this issue became that i just need to first get the backend to a running a state. Later if there are any imporvements people think they can do. They are welcomed. @Wahid7852 If you believe you can improve it later on maybe do that. Also i will look into conflicts. Thank you so much sir. I will definitely look into these facts and make sure that the pr is up to everyone's standard. |
|
@devanshi14malhotra Mam, Upon close inspection maybe it will be better if i leave the backend to get fixed by the maintainers themselves. I would love to contribute on it further somehow Closing this pull request. Thank you so much for your time. |
Fix Backend Initialization, Package Imports, Dependency Resolution, and Local Development Stability
Closes #754
I would recommend reading the contribution.md file i have included a part where running the backend is explained properly. @devanshi14malhotra I think you will be able to get a lot of this pr from there. I have also added successful screenshots of api testing below. Maam, This PR only contains all the relevant changes. I hope you find all the changes to your liking.
Thank you so much, maam.
Overview
This PR resolves multiple backend setup and runtime issues that prevented the BiblioDrift Flask backend from running successfully in a modern local development environment using Python 3.12.
The fixes primarily focus on:
Problems Identified
While setting up the backend locally, several critical issues were encountered:
Package & Import Issues
ModuleNotFoundErrorfor multiple internal backend modulesExamples:
Dependency Issues
Missing runtime dependencies caused backend initialization failures.
Example:
Configuration & Environment Issues
Flask Runtime Instability
Flask debug auto-reloader caused repeated crashes/restarts on Windows during heavy AI imports.
Examples:
Security Middleware Blocking Local Testing
CSRF protection prevented testing API endpoints locally using:
Changes Made
1. Converted Backend Into Proper Python Package
Added:
This enables correct package execution:
instead of relying on directory-based execution.
2. Fixed Internal Backend Imports
Updated backend imports to use package-qualified module paths.
Examples:
→
Similar fixes applied across multiple backend modules including:
This resolved repeated module resolution failures.
3. Added Missing Pillow Dependency
Added missing image-processing dependency:
to:
This resolved:
and ensured backend image utilities initialize correctly.
4. Fixed Dataclass Configuration Initialization
Resolved configuration initialization issues by ensuring config classes were properly structured for constructor-based initialization.
This fixed runtime errors such as:
5. Stabilized Flask Development Runtime
Updated Flask startup configuration to disable unstable auto-reloader behavior during local development.
Updated:
to:
This resolved:
6. Fixed SQLite Local Database Initialization
Updated local database configuration for reliable development startup.
Configured:
I just wasnot able to do it inside the instance folder so did this.
This resolved:
7. Added Development-Only CSRF Handling
Added conditional CSRF bypass for development mode only:
This enables:
while preserving production security behavior.
Endpoints Verified
Health Endpoint
Verified:
Chat Endpoint
Verified:

Mood Search Endpoint
Verified:

Environment Used
Notes
Result
Backend now: