0
2

More than 3 years have passed since last update.

[メモ] electron-flask

Last updated at Posted at 2021-06-21

image.png

概要

環境

  • Windows 10 64bit 21H1 (仮想機にて確認. 2021/6/21現在)
    • Python v3.9.5 (venv使用)
    • Node,js (LTS) v14.17.1
    • 作業フォルダ: C:\develop\

手順

インストール関連

  1. PowerShellを管理者で起動。Win+x a Alt+y

  2. インストール: Chocolatey (パッケージマネージャ)

    管理者
    Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
    
  3. インストール: python nodejs git vscode

    管理者
    cinst -y vscode git python3 nodejs-lts ; exit
    
  4. インストール: VSCodeの拡張機能 (お好みで)

    • PowerShellをユーザで起動(Win+x i)して、以下、こぴぺ

      ユーザ
      code --install-extension GitHub.github-vscode-theme
      code --install-extension vscode-icons-team.vscode-icons
      code --install-extension CoenraadS.bracket-pair-colorizer-2
      code --install-extension oderwat.indent-rainbow
      #
      code --install-extension ms-python.python
      code --install-extension ecmel.vscode-html-css
      
  5. ssh serverのインストール(デバッグ用)

Electron-Flask

  • git-clone~実行前まで。

    mkdir C:\develop
    cd C:\develop
    git clone https://github.com/matbloch/electron-flask
    cd electron-flask
    # venv
    python -m venv venv
    .\venv\Scripts\Activate.ps1
    #
    python -m pip install -r requirements.txt
    npm install
    
  • 実行

    # 実行:Electronにて
    cd C:\develop\electron-flask
    .\venv\Scripts\Activate.ps1
    .\node_modules\.bin\electron .
    #
    # 実行: PythonのFlask
    # Webブラウザで、http://localhost:4040/ にアクセス
    python web_app/run_app.py
    
  • パッケージ作成
    git-bash をひらいて、以下実行。distフォルダにSetupファイルができてる。

    # パッケージ作成
    cd /c/develop/electron-flask
    source ./venv/Scripts/activate
    #
    npm run package
    

その他

  • デスクトップアプリを作るとき、マルチプラットフォーム(Win/Linux)、Python使う、ってので調べてた時に見つけた
  • アプリを立ち上げたまま、ブラウザで、http://localhost:4040/にアクセスすると、つながる。
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2