mirror of
https://github.com/YunoHost-Apps/FastAPI_ynh.git
synced 2024-09-03 18:36:00 +02:00
commit
878571b9a1
6 changed files with 24 additions and 28 deletions
|
@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
|||
|
||||
This Application install a FastAPI application "Hello Word" ready to be customized by your own code
|
||||
|
||||
**Shipped version:** 1.0~ynh1
|
||||
**Shipped version:** 1.0~ynh2
|
||||
|
||||
## Screenshots
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po
|
|||
|
||||
Cette application installe une application FastAPI "Hello world" prête à être personnalisée par votre propre code.
|
||||
|
||||
**Version incluse :** 1.0~ynh1
|
||||
**Version incluse :** 1.0~ynh2
|
||||
|
||||
## Captures d’écran
|
||||
|
||||
|
|
|
@ -5,7 +5,8 @@ from fastapi import FastAPI
|
|||
|
||||
UVICORN_ROOT_PATH = os.environ.get('UVICORN_ROOT_PATH')
|
||||
|
||||
app = FastAPI(root_path=UVICORN_ROOT_PATH)
|
||||
#app = FastAPI(root_path=UVICORN_ROOT_PATH)
|
||||
app = FastAPI()
|
||||
|
||||
@app.get("/")
|
||||
def read_root():
|
||||
|
|
|
@ -7,31 +7,32 @@ location __PATH__/ {
|
|||
# Wide-open CORS config for nginx
|
||||
# From : https://enable-cors.org/server_nginx.html
|
||||
if ($request_method = 'OPTIONS') {
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||
more_set_headers "Access-Control-Allow-Origin: *";
|
||||
more_set_headers "Access-Control-Allow-Methods: GET, POST, OPTIONS";
|
||||
#
|
||||
# Custom headers and headers various browsers *should* be OK with but aren't
|
||||
#
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
|
||||
more_set_headers "Access-Control-Allow-Headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range";
|
||||
#
|
||||
# Tell client that this pre-flight info is valid for 20 days
|
||||
#
|
||||
add_header 'Access-Control-Max-Age' 1728000;
|
||||
add_header 'Content-Type' 'text/plain; charset=utf-8';
|
||||
add_header 'Content-Length' 0;
|
||||
more_set_headers "Access-Control-Max-Age: 1728000";
|
||||
more_set_headers "Content-Type: text/plain; charset=utf-8";
|
||||
more_set_headers "Content-Length: 0";
|
||||
return 204;
|
||||
}
|
||||
if ($request_method = 'POST') {
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
|
||||
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
|
||||
more_set_headers "Access-Control-Allow-Origin: * always";
|
||||
more_set_headers "Access-Control-Allow-Methods: GET, POST, OPTIONS always";
|
||||
more_set_headers "Access-Control-Allow-Headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range always";
|
||||
more_set_headers "Access-Control-Expose-Headers: Content-Length,Content-Range always";
|
||||
}
|
||||
|
||||
if ($request_method = 'GET') {
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
|
||||
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
|
||||
more_set_headers "Access-Control-Allow-Origin: * always";
|
||||
more_set_headers "Access-Control-Allow-Methods: GET, POST, OPTIONS always";
|
||||
more_set_headers "Access-Control-Allow-Headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range always";
|
||||
more_set_headers "Access-Control-Expose-Headers: Content-Length,Content-Range always";
|
||||
}
|
||||
|
||||
# this is needed if you have file import via upload enabled
|
||||
|
|
|
@ -7,7 +7,7 @@ name = "my_FastAPI_app"
|
|||
description.en = "Custom Web app to run a FastAPI program written in Python"
|
||||
description.fr = "Une application web personnalisée pour faire tourner une application FastAPI écrite en Python"
|
||||
|
||||
version = "1.0~ynh1"
|
||||
version = "1.0~ynh2"
|
||||
|
||||
maintainers = ["leonarf"]
|
||||
|
||||
|
@ -19,8 +19,11 @@ code = "https://github.com/leonarf/FastAPI_ynh"
|
|||
yunohost = ">= 11.2.5"
|
||||
architectures = "all"
|
||||
multi_instance = true
|
||||
|
||||
ldap = "not_relevant"
|
||||
|
||||
sso = "not_relevant"
|
||||
|
||||
disk = "50M"
|
||||
ram.build = "350M"
|
||||
ram.runtime = "50M"
|
||||
|
@ -39,7 +42,7 @@ ram.runtime = "50M"
|
|||
|
||||
[install.password]
|
||||
help.en = "Password that you will need to upload your code on YunoHost"
|
||||
help.fr = "Le mot de passe que vous utiliserez pour téléverser votre code sur Yunohost"
|
||||
help.fr = "Le mot de passe que vous utiliserez pour téléverser votre code sur YunoHost"
|
||||
type = "password"
|
||||
|
||||
[resources]
|
||||
|
@ -47,24 +50,16 @@ ram.runtime = "50M"
|
|||
allow_sftp = true
|
||||
allow_ssh = true
|
||||
home = "/home/yunohost.app/__APP__"
|
||||
# This will provision/deprovision a unix system user
|
||||
|
||||
[resources.install_dir]
|
||||
|
||||
[resources.data_dir]
|
||||
# This will create/remove the data dir as /home/yunohost.app/$app
|
||||
# and store the corresponding setting $data_dir
|
||||
dir = "/home/yunohost.app/__APP__"
|
||||
|
||||
[resources.permissions]
|
||||
# This will configure SSOwat permission for $domain/$path/
|
||||
# The initial allowed group of user is configured via the init_main_permission question (public=visitors, private=all_users)
|
||||
main.url = "/"
|
||||
|
||||
[resources.ports]
|
||||
# This will pick a random port for reverse-proxying and store it as the $port setting
|
||||
|
||||
[resources.apt]
|
||||
# This will automatically install/uninstall the following apt packages
|
||||
# and implicitly define the $phpversion setting as 8.0 (if phpX.Y-foobar dependencies are listed)
|
||||
packages = "python3-dev, python3-pip, python3-venv"
|
||||
|
|
|
@ -29,7 +29,6 @@ ynh_script_progression --message="Updating systemd service..." --weight=1
|
|||
|
||||
ynh_add_systemd_config
|
||||
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue