Skip to main content

FlaskFSRouter



Straightforward file-based routing extension for Flask. Introduces the concepts of pages to Flask.


Getting Started

pip install flask_fs_router


Initialize the extension.
from flask import Flask
from flask_fs_router import FlaskFSRouter

app = Flask(__name__)
FlaskFSRouter(app)

Pages are python files with a default function defined. These pages are stored in the /pages directory of your project, it is automatically available as a route based on its filename.

Create an example index route.

pages/index.py

def default():
    return "Home page"

Conventions

Index Pages

The index file of any folder is the name of that folder.

pages/ecommerce/index.py              ->         oursite.com/ecommerce     |  GET
pages/products/index.py               ->         oursite.com/products      |  GET

Static Routes



pages/index.py              ->        oursite.com/          |  GET
pages/about.py              ->        oursite.com/about     |  GET
pages/about/index.py        ->        oursite.com/about     |  GET
pages/about/me.py           ->        oursite.com/about/me  |  GET
pages/posts/1.py            ->        oursite.com/posts/1   |  GET
pages/posts/[post_id].py    ->        oursite.com/posts/<post_id>  |  GET

Request Methods

By default, pages map to GET requests. To change this behavior, define request methods within the file name using parentheses.

Example: Request methods

pages/posts/create_post(post).py            ->        oursite.com/posts/create-post  |  POST

Github Page

https://github.com/JarriqTheTechie/flask_fs_router

Contributing

We love the idea of a community. We'll be putting together a contribution guide in the near future.

License

flask_fs_router is available as open source under the terms of the MIT License http://opensource.org/licenses/MIT

Metadata

Release files for flask-fs-router 1.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flask-fs-router 1.1.3
File Size Uploaded Provenance Actions
flask-fs-router-1.1.3.tar.gz 4.9 kB Without provenance Details for flask-fs-router-1.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for flask-fs-router 1.1.3
File Interpreter ABI Platform Actions
flask_fs_router-1.1.3-py3-none-any.whl Python 3 none any Details for flask_fs_router-1.1.3-py3-none-any.whl

Total release size: 9.0 kB

Release files / flask-fs-router-1.1.3.tar.gz

Download URL flask-fs-router-1.1.3.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4ceac8f45b099d50aa0b93acdc33e59c67569a64b5f1ca5da640d2981de12090
BLAKE2b-256 checksum
How to use checksums
4fcedba824e95e147994548dbbdc4e5c8f152c58d42d9b04efd5511d62a4d4f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / flask_fs_router-1.1.3-py3-none-any.whl

Download URL flask_fs_router-1.1.3-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
722e5e87b908cb957c2dbd0536d6dd0c467e2fa74929b982cd25d4f507df4ca7
BLAKE2b-256 checksum
How to use checksums
b67bbbdb6072dabfdb0b31fe858f733308a78d5f194a9d4c8abddf3328240dc0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Security for flask-fs-router 1.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page