This project is a simple example of an MVC (Model-View-Controller) application in Python that utilizes SQL Server as the database. The application displays a list of users stored in the database.
Make sure you have the following packages installed:
pyodbc
: For connecting to SQL Server.flask
: For the view layer.
You can install these packages using pip
:
pip install pyodbc flask
- Create a database in SQL Server.
- Configure the connection to the database in the
db_config.py
file. Replace the values ofDRIVER
,SERVER
,DATABASE
,UID
, andPWD
with your server and database information.
db_config.py
: Configuration for connecting to SQL Server.model.py
: Definition of the data model.controller.py
: Controller that interacts with the model and provides data to the view.app.py
: Configuration of the Flask application and route definitions.templates/index.html
: HTML template for displaying the list of users.
- Ensure you have configured the database and installed the requirements as mentioned above.
- Run the Flask application with the following command:
python app.py
The application will be available at http://localhost:5000/
in your web browser.
You can customize this project according to your needs. Add new views, models, or controllers to extend the application's functionality.
If you wish to contribute to this project, feel free to do so! Open a pull request (PR) with your improvements.
This project is distributed under the MIT License.