
Security News
Open Source Maintainers Feeling the Weight of the EU’s Cyber Resilience Act
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
A lightweight static file server for Flet apps, designed to simplify mobile debugging by serving assets over a local network.
# **StaticServer Documentation** 🚀
The `StaticServer` class is designed to simplify debugging for mobile devices (iOS/Android) in Flet apps. It serves static files (like images, icons, or text files) from your computer, making them accessible to mobile devices during development. 📱💻
---
## **Why Use StaticServer?** 🤔
When developing for mobile:
- Direct file paths from your computer won’t work on devices. 🚫
- StaticServer hosts your files locally, providing a URL (`server.assets`) that devices can access. 🌐
- Perfect for debugging and testing assets on real devices. 🛠️
---
## **How to Use It** 🛠️
### **1. Installation**
pip install flet-staticserver
from flet_staticserver import StaticServer
Start the server and use it in your Flet app:
import flet as ft
from serve_files import StaticServer
# Initialize the server 🎬
server = StaticServer()
def main(page: ft.Page):
# Access files using server.assets 🖼️
page.add(
ft.Image(src=f"{server.assets}/icon.png"),
ft.Text(f"Access files at: {server.assets}")
)
# Run your Flet app 🚀
ft.app(main)
Customize the server to fit your needs:
server = StaticServer(
directory="path/to/your/assets", # 🗂️ Custom folder
port=2222 # 🚪 Custom port
)
Once the server is running, access your files like this:
{server.assets}/file.txt
{server.assets}/images/photo.jpg
Example:
ft.Image(src=f"{server.assets}/images/icon.png")
Display an image from your assets
folder on a mobile device:
import flet as ft
from serve_files import StaticServer
# Start the server 🎬
server = StaticServer()
def main(page: ft.Page):
# Display an image from the server 🖼️
page.add(
ft.Image(src=f"{server.assets}/icon.png"),
ft.Text("Your image is live!")
)
# Run the app 🚀
ft.app(main)
server.assets
to get the base URL for your files.Enjoy building and debugging your Flet apps! 🎉
FAQs
A lightweight static file server for Flet apps, designed to simplify mobile debugging by serving assets over a local network.
We found that flet-assets demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.