https://github.com/8area8/python-mvc
MVC with Python
https://github.com/8area8/python-mvc
Last synced: 23 days ago
JSON representation
MVC with Python
- Host: GitHub
- URL: https://github.com/8area8/python-mvc
- Owner: 8area8
- Created: 2021-02-19T13:14:06.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-04-20T12:58:15.000Z (over 4 years ago)
- Last Synced: 2025-03-21T23:35:06.547Z (9 months ago)
- Language: Python
- Size: 98.6 KB
- Stars: 0
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MVC architecture
Example of MVC architecture, which uses the Strategy and the Command pattern. The model is rather simple, and handles data recovery.
> **Note:** a more complex architecture, it may be necessary to decouple the data recovery from the model.
## Install
This application uses the python `3.X` version.
```bash
python3 -m venv .venv # or py -3 -m venv .venv on windows
. .venv/bin/activate # or . .venv/Scripts/activate on windows
pip install -r requirements.txt
```
> **Note:** the virtual environment is only useful for development purposes.
## Usage
```bash
python3 main.py # or py -3 main.py on windows
```
## Explanations
In terms of dependencies, the `Application` class has access to `views` and `commands`. The `view` knows the `commands`, and the `commands` know the `Application`.
The sequencing is simple: the `Application` displays the `view`, and the `view` returns a `command`, and the `command` updates the `Application`.