-
Clone this repo
-
Create a virtual environment
Python virtual environments allow you to install Python packages in a location isolated from the rest of your system instead of installing them system-wide.
You can learn more about virtual environments on the Python.land website
-
Activate the virtual environment
-
Install Poetry
Package management is handled via Poetry. If you don't have Poetry installed, you can install it by following the instructions on the Poetry website.
-
Install Dependencies
poetry install
-
Set Up Environment Variables
Create a
.env
file in the root directory of the project and add the necessary environment variabless:FLASK_APP=src.app FLASK_ENV=development FLASK_DEBUG=1 MAC_ADDRESS=your_mac_address_here URL=your_url_here
-
Run the Flask Application
With the virtual environment activated and environment variables set, you can now run your Flask application:
flask run --host=0.0.0.0 --port=5000
Access the application by opening your web browser and navigating to http://127.0.0.1:5000/.
If you want to use VSCode for development, create a .vscode\launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Flask",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/src/wakeonlanservice/app.py",
"env": {
"PYTHONPATH": "${workspaceFolder}/src",
"FLASK_ENV": "development",
"FLASK_DEBUG": "true",
"URL": you_url_here,
"MAC_ADDRESS": your_mac_address_here
},
"args": [],
"jinja": true
}
]
}
Run build.ps1
to build docker container.
Run build.ps1 -Run
to build and run the container.
To run tests, simply run command poetry run pytest
. This will run all tests.
If you only want to run unit tests, run: poetry run pytest tests/unit
Docker container can be found at https://hub.docker.com/r/drache42/wakeonlanservice