Kisan Yojana is a Flask + MySQL web application for discovering farmer subsidy schemes, browsing scheme categories, searching agricultural schemes, and viewing scheme details with eligibility, benefits, documents, and application steps.
- Farmer registration and login
- Google login support
- Reset password flow
- Category-wise scheme browsing
- Global scheme search
- Detailed scheme information page
- Scraper + ETL pipeline for importing scheme data into MySQL
- Python
- Flask
- MySQL
- Authlib
- Selenium
- HTML/CSS
checksubsidy/
|-- app.py
|-- requirements.txt
|-- README.md
|-- static/
|-- templates/
`-- database/
|-- python_to_mysql.py
|-- fetch&final.py
|-- scrappertry1.py
`-- my_test.json
- Create and activate a virtual environment.
python -m venv .venv
.venv\Scripts\activate- Install dependencies.
pip install -r requirements.txt- Set environment variables if your MySQL credentials differ from the defaults.
$env:DB_HOST="localhost"
$env:DB_USER="root"
$env:DB_PASSWORD="Patel_2101"
$env:DB_NAME="kisan_yojana"
$env:FLASK_SECRET_KEY="replace-this-for-production"Run the database setup script:
python database\python_to_mysql.pyThis creates:
farmerscategoriesschemes
It also ensures the documents_required column exists and inserts default categories/sample data.
If database\my_test.json is already present, load it into MySQL with:
python "database\fetch&final.py"Notes:
- This script truncates the
schemestable before inserting fresh data. - It automatically categorizes schemes into the main agriculture categories.
python app.pyOpen:
http://127.0.0.1:5000/
- Register a farmer account.
- Login with the created account or Google login.
- Show the dashboard with real category and scheme counts.
- Open
All Schemesand demonstrate live search. - Open a category and then a scheme detail page.
- Show the reset password flow if needed.
- Google auth was intentionally left unchanged.
- Existing old plain-text passwords are supported during login and automatically upgraded to hashed passwords after successful login.
- The app now uses environment variables for database connection and Flask secret configuration.
- If MySQL connection fails, verify the
DB_*environment variables. - If the scheme list is empty, run
python database\python_to_mysql.pyand thenpython "database\fetch&final.py". - If the scraper is used, make sure Chrome and ChromeDriver/Selenium setup works on your system.
- MySQL server running
- Dependencies installed
- Database initialized
- Scheme data loaded
- Test account created
- Internet available for Google login and location autocomplete