A web-based prototype for the Local Government Unit of Socorro, built using Python and Flask.
The website provides public information about Socorro, LGU departments, tourism, services, transparency documents, news and events, while also allowing residents to submit service requests, contact messages, and department inquiries.
- Python
- Flask 3.0.3
- SQLite
- HTML
- CSS
- JavaScript
- Jinja2 Templates
- LGU homepage
- About Socorro
- News and events
- Tourism information
- Government services
- LGU department directory
- Department inquiry submission
- Inquiry reference tracking
- Transparency documents
- Contact form
- Site-wide search
- Staff login
- Staff submissions dashboard
- Service request management
- Department inquiry status management
- SQLite database
- CSRF protection for protected forms
Make sure Python is installed on your computer.
Check by opening Command Prompt and running:
python --versionIf Python is not installed, install a recent version of Python 3.
During installation on Windows, make sure:
Add Python to PATH
is enabled.
Open Command Prompt, PowerShell, or Git Bash and run:
git clone https://github.com/edrianqt/LGU-Socorro-Web.gitThen enter the project directory:
cd LGU-Socorro-WebCreating a virtual environment is recommended so the project's Python packages remain isolated.
python -m venv .venvActivate it:
.venv\Scripts\activateAfter activation, your terminal should show something similar to:
(.venv) C:\...\LGU-Socorro-Web>
Install the packages listed in requirements.txt:
pip install -r requirements.txtThe project currently requires:
Flask==3.0.3
Run:
python app.pyThe Flask development server should start and display an address similar to:
http://127.0.0.1:5000
Open that address in your browser.
No MySQL or external database server is required.
The project uses SQLite.
When the application starts, it automatically creates the required database and tables if they do not already exist.
The local database is stored at:
instance/lgu_socorro.sqlite
The application creates tables for:
- Contact messages
- Service requests
- Department requests
The instance/ directory is excluded from Git, so local database contents and generated credentials are not uploaded to the repository.
The application includes a staff-only area for reviewing submissions.
Staff login page:
http://127.0.0.1:5000/staff/login/
The default username is:
staff
On the first run, the application automatically generates a secure random staff password.
The generated credentials are stored locally in:
instance/staff-access.json
Open that file after starting the application to retrieve the generated password.
Example structure:
{
"username": "staff",
"password": "generated-password"
}Do not commit this file to GitHub.
After signing in, staff can access the submissions dashboard and review contact messages, service requests, and department inquiries.
For deployment or a more permanent local configuration, the application supports environment variables.
You can specify your own staff password using:
SOCORRO_STAFF_PASSWORD
You can also specify the application's session secret using:
SOCORRO_SECRET_KEY
If these are not provided, the application generates local values automatically.
LGU-Socorro-Web/
│
├── app.py
├── requirements.txt
├── .gitignore
├── DEPARTMENTS.md
│
├── data/
│ ├── site_data.json
│ └── departments.json
│
├── static/
│ └── CSS, JavaScript, images and other static assets
│
├── templates/
│ └── Flask/Jinja2 HTML templates
│
├── tests/
│ └── Application tests
│
├── _reference/
│ └── Reference resources
│
└── instance/
├── lgu_socorro.sqlite
├── staff-access.json
└── session-secret.txt
The instance/ directory is generated locally and ignored by Git.
After completing the installation once, you normally only need to run:
cd LGU-Socorro-Web
.venv\Scripts\activate
python app.pyThen visit:
http://127.0.0.1:5000
If the repository has already been cloned, retrieve the newest changes with:
git pull origin mainThen reinstall requirements if dependencies have changed:
pip install -r requirements.txtRun the application again:
python app.pyPython is either not installed or has not been added to your system PATH.
Install Python and enable Add Python to PATH during installation.
You can also try:
py --versionand use:
py app.pyinstead.
Activate the virtual environment:
.venv\Scripts\activateThen install the requirements:
pip install -r requirements.txtAnother application may already be using Flask's default port.
Stop the other application and run the project again.
The local database is located at:
instance/lgu_socorro.sqlite
For a fresh development database, stop the application, remove the local SQLite database, and start the application again.
The required tables will be recreated automatically.
LGU Socorro Web
https://github.com/edrianqt/LGU-Socorro-Web
Developed as an LGU website prototype for the Municipality of Socorro.