Skip to content

Commit

Permalink
Merge pull request #14 from Bryanthelol/main
Browse files Browse the repository at this point in the history
deploy: frontend to Pages; backend to PythonAnyWhere
  • Loading branch information
tkzt authored Aug 4, 2024
2 parents 733cce4 + ea525a0 commit 8cb8f0d
Show file tree
Hide file tree
Showing 7 changed files with 225 additions and 186 deletions.
26 changes: 23 additions & 3 deletions .github/workflows/app.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
name: App Workflow

permissions:
contents: write

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
name: Lint and build
lint_build_deploy:
env:
VITE_BASE: /fine-weather
VITE_IMG_FETCH_BASE: https://bryanthe.pythonanywhere.com
name: Lint and build and deploy
runs-on: ubuntu-latest
defaults:
run:
working-directory: app
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
with:
Expand All @@ -29,7 +36,20 @@ jobs:

- name: Install dependencies
run: pnpm install

- name: Lint
run: pnpm run lint

- name: Build
run: pnpm run build

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./app/dist





3 changes: 2 additions & 1 deletion app/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ export default defineConfig({
changeOrigin: true
}
}
}
},
base: process.env.VITE_BASE ?? "/"
})
8 changes: 8 additions & 0 deletions manager/app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
from fw_manager import create_app

import os

from dotenv import load_dotenv

dotenv_path = os.path.join(os.path.dirname(__file__), '.env')
if os.path.exists(dotenv_path):
load_dotenv(dotenv_path)

app = create_app()
2 changes: 2 additions & 0 deletions manager/fw_manager/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from flask_bootstrap import Bootstrap5
from flask import Flask
from flask_wtf import CSRFProtect
from flask_cors import CORS

from . import commands, blueprints
from .models import db
Expand All @@ -14,6 +15,7 @@ def create_app():

Bootstrap5(app)
CSRFProtect(app)
CORS(app)
commands.init_app(app)
db.init_app(app)
blueprints.init_app(app)
Expand Down
370 changes: 188 additions & 182 deletions manager/pdm.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions manager/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dependencies = [
"pillow>=10.2.0",
"blurhash-python>=1.2.1",
"flask-httpauth>=4.8.0",
"flask-cors>=4.0.1"
]
requires-python = ">=3.12"
readme = "README.md"
Expand Down
1 change: 1 addition & 0 deletions manager/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ virtualenv==20.25.0
werkzeug==3.0.1
win32-setctime==1.1.0; sys_platform == "win32"
wtforms==3.1.1
flask-cors==4.0.1

0 comments on commit 8cb8f0d

Please sign in to comment.