This makes it easy to manage multiple views with dynamic routing.
This is an utility class based on repath library which allows matching ExpressJS-like routes and parsing their parameters, for example /account/:account_id/orders/:order_id.
Differences from flet-route
- Flet-Route-Static is made to work with Flet Static Websites. The standard Flet-Route Package does not support this at the moment.
- Changes:
- Removed
repathdependency. - Removed
fletdependency (Static websites installflet-pyodideby itself) - Removed
CLIcommands (Does not need to be available in static websites)
- Removed
How To Use:
- Add
flet-easy-staticto your projectrequirements.txt - How To Import Package:
# Method 1: Importing the package as fs in your project
import flet_route_static as fs
# Method 2: Check if the platform is emscripten and import the package accordingly
# This method is useful if you want to run the same code on both the desktop and the web and you don't have to install flet_route_static package on your desktop
if sys.platform == "emscripten": # Check if in Pyodide environment
import flet_route_static as fs
else:
import flet_route as fs
- Now you can safely run
flet publishon your static website application
This pacakge is just a small modification of the original Flet-Route package and all the credit goes to the original author Saurabh
How to make --route-url-strategy path work in flet-route-static:
- Since a static webpage with flet is a singe page application, the
--route-url-strategy pathdoes not work as expected when hosted (Not when running main.py)-
For Apache:
- Check if
Include conf/extra/httpd-vhosts.confis uncommented inhttpd.conf - Check if
LoadModule rewrite_module modules/mod_rewrite.sois uncommented inhttpd.conf - Modify
httpd-vhosts.confto look like this:<VirtualHost *:80> ServerAdmin webmaster@yourdomain.com DocumentRoot "C:/xampp/htdocs" ServerName localhost <Directory "C:/xampp/htdocs/"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Require all granted RewriteEngine On RewriteBase / # Exclude phpmyadmin and acustom from rewrite rules RewriteCond %{REQUEST_URI} ^/phpmyadmin [NC,OR] RewriteCond %{REQUEST_URI} ^/!custom [NC] RewriteRule ^ - [L] # If a file or directory exists, serve it directly RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] # Otherwise, rewrite all other requests to index.html RewriteRule ^ /index.html [L] </Directory> # Configuration for phpMyAdmin Alias /phpmyadmin "C:/xampp/phpMyAdmin" <Directory "C:/xampp/phpMyAdmin"> Options Indexes FollowSymLinks AllowOverride All <RequireAny> # Localhost Require ip 127.0.0.1 # IPv6 Localhost Require ip ::1 # Specific IP Require ip 192.168.10.161 </RequireAny> </Directory> # Configuration for acustom directory Alias /!custom "C:/xampp/htdocs/!custom" <Directory "C:/xampp/htdocs/!custom"> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> </VirtualHost> # Configuration for phpMyAdmin Alias /phpmyadmin "C:/xampp/phpMyAdmin" <Directory "C:/xampp/phpMyAdmin"> Options Indexes FollowSymLinks AllowOverride All <RequireAny> # Localhost Require ip 127.0.0.1 # IPv6 Localhost Require ip ::1 # Specific IP Require ip 192.168.10.161 </RequireAny> </Directory> # Configuration for acustom directory Alias /!custom "C:/xampp/htdocs/!custom" <Directory "C:/xampp/htdocs/!custom"> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> </VirtualHost>
- This
httpd-vhosts.conffile is for XAMPP. Modify it according to your server configuration !customis a directory inhtdocswhich is not affected by the rewrite ruleshtdocsis the same directory where theindex.htmlis located. In linux systems the directory is/var/www/htmlnormally
phpmyadminis also not affected by the rewrite rules- Everything else is redirected to
index.htmlso that the SPA can handle the routing (Fixes sowebsite.com/routeworks as expected)
- Check if
-
For Nginx:
- Work In Progress
-
Installation
pip install flet-route-static
Upgradation
pip install flet-route-static --upgrade
📖 Read the documentation
Original Author:
Name : Saurabh Wadekar
Email : saurabhwadekar420@gmail.com
County : 🇮🇳INDIA🇮🇳
Changes made by:
- SmokyAce
- Discrd: smokyace
Metadata
Release files for flet-route-static 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flet_route_static-0.0.2.tar.gz | 6.3 kB | Without provenance | Details for flet_route_static-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flet_route_static-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for flet_route_static-0.0.2-py3-none-any.whl |
Total release size: 13.6 kB
Release files / flet_route_static-0.0.2.tar.gz
| Download URL | flet_route_static-0.0.2.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ceef32abbac3cfbf24c63d8efd8a5b086607573e068406a0ee48bea48d316297
|
|
BLAKE2b-256 checksum How to use checksums |
c5ce0f8cb393e5a328433bd4debe43960b59bdc6dc8122d81e71b824c3130767
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.11.4
|
Release files / flet_route_static-0.0.2-py3-none-any.whl
| Download URL | flet_route_static-0.0.2-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7c1f64f6e120dd418359e16847568cc68a76d10be3ee20cc5557ecd598e58173
|
|
BLAKE2b-256 checksum How to use checksums |
02f1d43bfd89c507085681d2365c6baa6a574c5e250769f3d1137f2decaa8d8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.11.4
|
Security for flet-route-static 0.0.2
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.