File tree Expand file tree Collapse file tree 3 files changed +440
-0
lines changed Expand file tree Collapse file tree 3 files changed +440
-0
lines changed Original file line number Diff line number Diff line change
1
+ # deploy.py
2
+ import modal
3
+
4
+ # Define the base image
5
+ image = (
6
+ modal .Image .debian_slim (python_version = "3.13" )
7
+ .apt_install ("libpq-dev" , "libwebp-dev" )
8
+ .pip_install_from_pyproject ("pyproject.toml" )
9
+ .add_local_python_source ("main" )
10
+ .add_local_python_source ("routers" )
11
+ .add_local_python_source ("utils" )
12
+ .add_local_python_source ("exceptions" )
13
+ .add_local_dir ("static" , remote_path = "/root/static" )
14
+ .add_local_dir ("templates" , remote_path = "/root/templates" )
15
+ )
16
+
17
+ # Define the Modal App
18
+ app = modal .App (
19
+ name = "fastapi-jinja2-postgres-webapp" ,
20
+ image = image ,
21
+ secrets = [modal .Secret .from_name ("fastapi-jinja2-postgres-webapp" )]
22
+ )
23
+
24
+
25
+ # Define the ASGI app function
26
+ @app .function ()
27
+ @modal .asgi_app ()
28
+ def fastapi_app ():
29
+ from main import app as web_app
30
+
31
+ return web_app
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ dependencies = [
21
21
" bcrypt<5.0.0,>=4.2.0" ,
22
22
" fastapi<1.0.0,>=0.115.5" ,
23
23
" pillow>=11.0.0" ,
24
+ " modal>=0.73.162" ,
24
25
]
25
26
26
27
[dependency-groups ]
You can’t perform that action at this time.
0 commit comments