turn standard Flask into mvc
Project description
You can use the MVC pattern in your Flask application using this extension.
Installation
Run the follow command to install mvc_flask
:
$ pip install mvc_flask
Basic Usage
To start the mvc_flask
you need to import and register in your application.
from flask import Flask
from mvc_flask import FlaskMVC
app = Flask(__name__)
FlaskMVC(app)
Or use application factories
, e.g:
mvc = FlaskMVC()
def create_app():
...
mvc.init_app(app)
By default the mvc_flask
assumes that your application directory will be app
and if it doesn't exist, create it!
If you can use other directories, you can use the path
parameter when the instance of FlaskMVC is initialized. E.g:
mvc = FlaskMVC()
def create_app():
...
mvc.init_app(app, path='src')
Now, you can use src
as default directory for prepare your application.
You structure should be look like this:
app
├── __ini__.py
├── controllers
│ └── home_controller.py
├── routes.py
└── views
├── index.html
Please visit the documentation to check more details https://marcuxyz.github.io/mvc-flask
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mvc_flask-2.9.0.tar.gz
.
File metadata
- Download URL: mvc_flask-2.9.0.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.10.12 Darwin/23.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad1d7c6ab3b2eec38fcfd86589c53675e27a96fcd2913bbfe41fc7a94c9c6ed7 |
|
MD5 | c6d27eff9c5923e27e6db1928fc06fad |
|
BLAKE2b-256 | 192331f38d85fed58a7257617c9627fb73a759da209a34264920d956776475ac |
File details
Details for the file mvc_flask-2.9.0-py3-none-any.whl
.
File metadata
- Download URL: mvc_flask-2.9.0-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.10.12 Darwin/23.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41fc8be06b1239c49873b8a2f4118f0714c32ed6ae163a98fa3ee3b246a67b69 |
|
MD5 | fb39bf59ab0b3821f761297be1b4e36d |
|
BLAKE2b-256 | 23dbc91dc41ec57aa202403c1f8eddf321527e241de17a6096bf0ce7dc23f5ae |