actually added ports

This commit is contained in:
Boyan 2024-12-08 00:10:54 +01:00
parent 8bf5186ed6
commit 061c923ff4
4 changed files with 13 additions and 1 deletions

View File

@ -12,6 +12,7 @@ COPY src/manage_users.py /app/src/
RUN python /app/src/manage_users.py init RUN python /app/src/manage_users.py init
ENV FLASK_APP=src/app.py ENV FLASK_APP=src/app.py
ENV FLASK_RUN_HOST=0.0.0.0 ENV FLASK_RUN_HOST=0.0.0.0
ENV FLASK_RUN_PORT=49152
EXPOSE 49152 EXPOSE 49152

View File

@ -10,6 +10,7 @@ services:
environment: environment:
FLASK_APP: src/app.py FLASK_APP: src/app.py
FLASK_RUN_HOST: 0.0.0.0 FLASK_RUN_HOST: 0.0.0.0
FLASK_RUN_PORT: 49152
command: sh -c "python /app/src/manage_users.py init && flask run" command: sh -c "python /app/src/manage_users.py init && flask run"
networks: networks:
shortn-network: shortn-network:

View File

@ -139,6 +139,12 @@ def create_user():
except sqlite3.IntegrityError: except sqlite3.IntegrityError:
return 'User already exists.' return 'User already exists.'
# 404
@app.errorhandler(404)
def page_not_found(e):
return render_template('404.html'), 404
if __name__ == '__main__': if __name__ == '__main__':
init_db() init_db()
app.run(debug=True) app.run(debug=False)

4
src/templates/404.html Normal file
View File

@ -0,0 +1,4 @@
{% extends 'base.html' %} {% block title %}404{% endblock %} {% block content %}
<h1 class="bad-wrong">404</h1>
<p>Page not found</p>
{% endblock %}