-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
copy fasthtml example from vercel/vercel (#1010)
- Loading branch information
1 parent
2756c58
commit 1ec2efa
Showing
5 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.vercel | ||
.sesskey |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# FastHTML Boilerplate | ||
|
||
Deploy your [FastHTML](https://fastht.ml/) project to Vercel with zero configuration. | ||
|
||
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/vercel/examples/tree/main/framework-boilerplates/fasthtml&template=fasthtml) | ||
|
||
_Live Example: https://fasthtml-template.vercel.app_ | ||
|
||
Visit the [FastHTML documentation](https://docs.fastht.ml/) to learn more. | ||
|
||
## Getting Started | ||
|
||
Install the required dependencies: | ||
|
||
```bash | ||
pip install -r requirements.txt | ||
``` | ||
|
||
## Running Locally | ||
|
||
Start the development server on http://0.0.0.0:5001 | ||
|
||
```bash | ||
python main.py | ||
``` | ||
|
||
When you make changes to your project, the server will automatically reload. | ||
|
||
## Deploying to Vercel | ||
|
||
Deploy your project to Vercel with the following command: | ||
|
||
```bash | ||
npm install -g vercel | ||
vercel --prod | ||
``` | ||
|
||
Or `git push` to your repostory with our [git integration](https://vercel.com/docs/deployments/git). | ||
|
||
To view the source code for this template, [visit the example repository](https://github.com/vercel/vercel/tree/main/examples/fasthtml). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from fasthtml.common import * | ||
|
||
app, rt = fast_app(hdrs=(picolink)) | ||
|
||
|
||
@rt("/") | ||
def get(): | ||
return ( | ||
Socials( | ||
title="Vercel + FastHTML", | ||
site_name="Vercel", | ||
description="A demo of Vercel and FastHTML integration", | ||
image="https://vercel.fyi/fasthtml-og", | ||
url="https://fasthtml-template.vercel.app", | ||
twitter_site="@vercel", | ||
), | ||
Container( | ||
Card( | ||
Group( | ||
P( | ||
"FastHTML is a new next-generation web framework for fast, scalable web applications with minimal, compact code. It builds on top of popular foundations like ASGI and HTMX. You can now deploy FastHTML with Vercel CLI or by pushing new changes to your git repository.", | ||
), | ||
), | ||
header=(Titled("FastHTML + Vercel")), | ||
footer=( | ||
P( | ||
A( | ||
"Deploy your own", | ||
href="https://vercel.com/templates/python/fasthtml-python-boilerplate", | ||
), | ||
" or ", | ||
A("learn more", href="https://docs.fastht.ml/"), | ||
"about FastHTML.", | ||
) | ||
), | ||
), | ||
), | ||
) | ||
|
||
|
||
serve() |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
python-fasthtml==0.4.4 | ||
sqlite_minutils==4.0.3 | ||
uvicorn==0.30.1 |