it's flask now lol
This commit is contained in:
parent
31682e9b62
commit
3fbb143475
6 changed files with 31 additions and 13 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
**.pyc
|
**.pyc
|
||||||
**/__pycache__/**
|
**/__pycache__/**
|
||||||
|
data/**
|
||||||
|
|
14
Dockerfile
14
Dockerfile
|
@ -1,7 +1,11 @@
|
||||||
|
#Download Python from DockerHub and use it
|
||||||
FROM python:alpine
|
FROM python:alpine
|
||||||
ENV PYTHONUNBUFFERED=1
|
|
||||||
WORKDIR /powerpanel-webview
|
|
||||||
COPY requirements.txt /powerpanel-webview/
|
|
||||||
RUN pip install -r requirements.txt
|
|
||||||
COPY . /powerpanel-webview/
|
|
||||||
|
|
||||||
|
#Set the working directory in the Docker container
|
||||||
|
WORKDIR /code
|
||||||
|
|
||||||
|
#Copy the dependencies file to the working directory
|
||||||
|
COPY requirements.txt .
|
||||||
|
|
||||||
|
#Install the dependencies
|
||||||
|
RUN pip install -r requirements.txt
|
|
@ -5,15 +5,18 @@ services:
|
||||||
powerpanel-webview:
|
powerpanel-webview:
|
||||||
build: .
|
build: .
|
||||||
image: powerpanel-webview:latest
|
image: powerpanel-webview:latest
|
||||||
command: python manage.py runserver 0.0.0.0:8000
|
command: python /code/app.py
|
||||||
ports: "8000:8000"
|
ports:
|
||||||
volumes: .:/powerpanel-webview
|
- "9090:9090"
|
||||||
depends_on: db
|
volumes:
|
||||||
|
- ./src:/code
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
db:
|
db:
|
||||||
image: postgres:alpine
|
image: postgres:alpine
|
||||||
volumes: ./data/db:/var/lib/postgresql/data
|
volumes:
|
||||||
|
- ./data/db:/var/lib/postgresql/data
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_DB=powerpanel-db
|
- POSTGRES_DB=powerpanel-db
|
||||||
- POSTGRES_USER=postgres
|
- POSTGRES_USER=postgres
|
||||||
- POSTGRES_PASSWORD=1t3ySxqFnqb8KrCAecIHb34v
|
- POSTGRES_PASSWORD=1t3ySxqFnqb8KrCAecIHb34v
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1 @@
|
||||||
Django>=3.0
|
Flask
|
||||||
psycopg2-binary>=2.8
|
|
11
src/app.py
Normal file
11
src/app.py
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
from flask import Flask
|
||||||
|
from powerpanel_manage import get_status_dict
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
@app.route('/')
|
||||||
|
def main_page():
|
||||||
|
status_dict = get_status_dict()
|
||||||
|
return status_dict
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
app.run(host='0.0.0.0', port=9090)
|
Reference in a new issue