rename forest.py and email.py to fit execution

This commit is contained in:
deflax 2024-03-31 18:22:08 +03:00
parent e84396fc28
commit 5c8597a957
10 changed files with 18 additions and 12 deletions

4
.gitignore vendored
View file

@ -13,6 +13,10 @@ data/db/*
data/dbadmin/* data/dbadmin/*
!data/dbadmin/.placeholder !data/dbadmin/.placeholder
# ignore pgadmin volumes
data/pgadmin/*
!data/pgadmin/.placeholder
# ignore osmtile postgresql volume # ignore osmtile postgresql volume
data/osmtile/* data/osmtile/*
!data/osmtile/.placeholder !data/osmtile/.placeholder

View file

@ -14,9 +14,10 @@ services:
pgadmin: pgadmin:
image: dpage/pgadmin4 image: dpage/pgadmin4
volumes: volumes:
- "./data/pgadmin/lib:/var/lib/pgadmin" - "./data/pgadmin:/var/lib/pgadmin"
env_file: env_file:
- ./.env - ./.env
user: '$UID:$GID'
ports: ports:
- 5050:80 - 5050:80
restart: always restart: always
@ -39,6 +40,8 @@ services:
- internal - internal
labels: labels:
- meta.role=forest - meta.role=forest
#profiles:
# - donotstart
# osmtile: # osmtile:
# image: overv/openstreetmap-tile-server:2.3.0 # image: overv/openstreetmap-tile-server:2.3.0

View file

@ -20,6 +20,4 @@ COPY . $APP_HOME
RUN --mount=type=cache,target=/root/.cache \ RUN --mount=type=cache,target=/root/.cache \
pip3 install -r requirements.txt pip3 install -r requirements.txt
EXPOSE 8080 CMD ["python","app.py"]
CMD [ "waitress-serve", "--port=5000", "--call", "forest:create_app"]

View file

@ -5,7 +5,7 @@ from flask_sqlalchemy import get_debug_queries
from . import admin from . import admin
from .. import db from .. import db
from ..email import send_email from ..mailsender import send_email
from ..models import User, Item from ..models import User, Item
from ..decorators import admin_required, permission_required from ..decorators import admin_required, permission_required
@ -40,4 +40,4 @@ def list_users(page):
@admin_required @admin_required
def list_items(): def list_items():
allservices = Item.query.order_by(Item.date_created.asc()).all() allservices = Item.query.order_by(Item.date_created.asc()).all()
return render_template('admin/list_items.html', items=allitems) return render_template('admin/list_items.html', items=allitems)

View file

@ -13,6 +13,7 @@ from flask import (
redirect, redirect,
url_for url_for
) )
from waitress import serve
from flask_sqlalchemy import SQLAlchemy from flask_sqlalchemy import SQLAlchemy
from flask_bootstrap import Bootstrap from flask_bootstrap import Bootstrap
from flask_mail import Mail from flask_mail import Mail
@ -104,5 +105,5 @@ def service_unavailable(e):
def handle_csrf_error(e): def handle_csrf_error(e):
return render_template('errors/csrf_error.html', reason=e.description), 400 return render_template('errors/csrf_error.html', reason=e.description), 400
def create_app(): if __name__ == "__main__":
return app serve(app, listen='*:5000')

View file

@ -4,7 +4,7 @@ from flask_login import login_required, login_user, logout_user, current_user
from . import auth from . import auth
from .. import db from .. import db
from ..models import User from ..models import User
from ..email import send_email from ..mailsender import send_email
from .forms import LoginForm, TwoFAForm, RegistrationForm, ChangePasswordForm, PasswordResetRequestForm, PasswordResetForm from .forms import LoginForm, TwoFAForm, RegistrationForm, ChangePasswordForm, PasswordResetRequestForm, PasswordResetForm
from ..decorators import admin_required, permission_required from ..decorators import admin_required, permission_required

View file

@ -5,7 +5,7 @@ from flask_sqlalchemy import get_debug_queries
from . import main from . import main
from .forms import LoginForm, RegistrationForm from .forms import LoginForm, RegistrationForm
from .. import db from .. import db
from ..email import send_email from ..mailsender import send_email
from ..models import User, Permission, Item from ..models import User, Permission, Item
import base64 import base64

View file

@ -4,7 +4,7 @@ from flask_sqlalchemy import get_debug_queries
from . import panel from . import panel
from .. import db from .. import db
from ..email import send_email from ..mailsender import send_email
from ..models import User, Permission, Item from ..models import User, Permission, Item
import base64 import base64

View file

@ -5,7 +5,7 @@ from sqlalchemy import desc
from . import settings from . import settings
from .forms import EditProfileForm, EditProfileAdminForm from .forms import EditProfileForm, EditProfileAdminForm
from ..email import send_email from ..mailsender import send_email
from .. import db from .. import db
from ..models import User from ..models import User
import sys import sys