Version Update 2023-12-12
This commit is contained in:
117
.dockerignore
117
.dockerignore
@ -1,2 +1,119 @@
|
||||
.git
|
||||
*.pdf
|
||||
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
.idea/**/aws.xml
|
||||
.idea/**/contentModel.xml
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
cmake-build-*/
|
||||
.idea/**/mongoSettings.xml
|
||||
*.iws
|
||||
out/
|
||||
.idea_modules/
|
||||
atlassian-ide-plugin.xml
|
||||
.idea/replstate.xml
|
||||
.idea/sonarlint/
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
.idea/httpRequests
|
||||
.idea/caches/build_file_checksums.ser
|
||||
.Python
|
||||
[Bb]in
|
||||
[Ii]nclude
|
||||
[Ll]ib
|
||||
[Ll]ib64
|
||||
[Ll]ocal
|
||||
[Ss]cripts
|
||||
pyvenv.cfg
|
||||
.venv
|
||||
pip-selfcheck.json
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
*.so
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
*.manifest
|
||||
*.spec
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
cover/
|
||||
*.mo
|
||||
*.pot
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
instance/
|
||||
.webassets-cache
|
||||
.scrapy
|
||||
docs/_build/
|
||||
.pybuilder/
|
||||
target/
|
||||
.ipynb_checkpoints
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
.pdm.toml
|
||||
__pypackages__/
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
*.sage.py
|
||||
.env
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
.spyderproject
|
||||
.spyproject
|
||||
.ropeproject
|
||||
/site
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
.pyre/
|
||||
.pytype/
|
||||
cython_debug/
|
||||
instance/*
|
||||
!instance/.gitignore
|
||||
|
116
.gitignore
vendored
Normal file
116
.gitignore
vendored
Normal file
@ -0,0 +1,116 @@
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
.idea/**/aws.xml
|
||||
.idea/**/contentModel.xml
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
cmake-build-*/
|
||||
.idea/**/mongoSettings.xml
|
||||
*.iws
|
||||
out/
|
||||
.idea_modules/
|
||||
atlassian-ide-plugin.xml
|
||||
.idea/replstate.xml
|
||||
.idea/sonarlint/
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
.idea/httpRequests
|
||||
.idea/caches/build_file_checksums.ser
|
||||
.Python
|
||||
[Bb]in
|
||||
[Ii]nclude
|
||||
[Ll]ib
|
||||
[Ll]ib64
|
||||
[Ll]ocal
|
||||
[Ss]cripts
|
||||
pyvenv.cfg
|
||||
.venv
|
||||
pip-selfcheck.json
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
*.so
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
*.manifest
|
||||
*.spec
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
cover/
|
||||
*.mo
|
||||
*.pot
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
instance/
|
||||
.webassets-cache
|
||||
.scrapy
|
||||
docs/_build/
|
||||
.pybuilder/
|
||||
target/
|
||||
.ipynb_checkpoints
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
.pdm.toml
|
||||
__pypackages__/
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
*.sage.py
|
||||
.env
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
.spyderproject
|
||||
.spyproject
|
||||
.ropeproject
|
||||
/site
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
.pyre/
|
||||
.pytype/
|
||||
cython_debug/
|
||||
instance/*
|
||||
!instance/.gitignore
|
@ -1,12 +0,0 @@
|
||||
# You can override the included template(s) by including variable overrides
|
||||
# SAST customization: https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings
|
||||
# Secret Detection customization: https://docs.gitlab.com/ee/user/application_security/secret_detection/#customizing-settings
|
||||
# Dependency Scanning customization: https://docs.gitlab.com/ee/user/application_security/dependency_scanning/#customizing-the-dependency-scanning-settings
|
||||
# Note that environment variables can be set in several places
|
||||
# See https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence
|
||||
stages:
|
||||
- test
|
||||
sast:
|
||||
stage: test
|
||||
include:
|
||||
- template: Security/SAST.gitlab-ci.yml
|
@ -1,7 +1,8 @@
|
||||
FROM python:3.9-alpine
|
||||
RUN pip install --no-cache-dir Flask icalendar gunicorn Unidecode
|
||||
COPY . /app
|
||||
FROM python:3-alpine as base
|
||||
WORKDIR /app
|
||||
COPY requirements.txt .
|
||||
RUN pip install --compile --no-cache-dir --requirement requirements.txt
|
||||
COPY . /app
|
||||
|
||||
CMD ["gunicorn", "--workers=2", "--access-logfile", "-", "--log-level", "debug", "-b", "0.0.0.0:5000", "app:app"]
|
||||
CMD ["gunicorn", "-c", "gunicorn.py"]
|
||||
#CMD python app.py
|
||||
|
5
Makefile
Normal file
5
Makefile
Normal file
@ -0,0 +1,5 @@
|
||||
docker-build:
|
||||
docker build --tag=registry.72.lv/flask-namedays:latest --tag=flask-namedays:latest .
|
||||
|
||||
docker-push: docker-build
|
||||
docker push registry.72.lv/flask-namedays:latest
|
5
app.py
5
app.py
@ -1,6 +1,5 @@
|
||||
import datetime
|
||||
import json
|
||||
import logging
|
||||
import uuid
|
||||
from collections import defaultdict
|
||||
from io import BytesIO
|
||||
@ -65,9 +64,7 @@ def calendar():
|
||||
if cal:
|
||||
name = f"{uuid.uuid4().hex}.ics"
|
||||
f = generate_ical_for_mapping(cal)
|
||||
return send_file(
|
||||
f, mimetype="text/calendar", as_attachment=True, download_name=name
|
||||
)
|
||||
return send_file(f, mimetype="text/calendar", as_attachment=True, download_name=name)
|
||||
return render_template("namedays.html")
|
||||
|
||||
|
||||
|
92
gunicorn.py
Normal file
92
gunicorn.py
Normal file
@ -0,0 +1,92 @@
|
||||
""" Reference: https://docs.gunicorn.org/en/stable/settings.html """
|
||||
""" Config File https://docs.gunicorn.org/en/stable/settings.html#config-file """
|
||||
config = "gunicorn.py"
|
||||
wsgi_app = "app:app"
|
||||
|
||||
""" Debugging https://docs.gunicorn.org/en/stable/settings.html#debugging """
|
||||
# reload = False
|
||||
# reload_engine = "auto"
|
||||
# reload_extra_files = []
|
||||
# spew = False
|
||||
# check_config = False
|
||||
# print_config = False
|
||||
|
||||
""" Logging https://docs.gunicorn.org/en/stable/settings.html#logging """
|
||||
accesslog = "-"
|
||||
# disable_redirect_access_to_syslog = False
|
||||
access_log_format = "%(t)s [%({HTTP_X_REAL_IP}e)s] '%(m)s' %(s)s %(b)s '%(U)s' '%(q)s' '%(a)s' '%(D)s'"
|
||||
# errorlog = "-"
|
||||
loglevel = "debug"
|
||||
capture_output = True
|
||||
# logger_class = 'gunicorn.glogging.Logger'
|
||||
# logconfig = None
|
||||
# logconfig_dict = dict()
|
||||
# logconfig_json = None
|
||||
# syslog_addr = 'udp://localhost:514'
|
||||
# syslog = None
|
||||
# syslog_prefix = None
|
||||
# syslog_facility = "user"
|
||||
# enable_stdio_inheritance = False
|
||||
# statsd_host = None
|
||||
# dogstatsd_tags = ""
|
||||
# statsd_prefix = ""
|
||||
|
||||
""" Process Naming https://docs.gunicorn.org/en/stable/settings.html#process-naming """
|
||||
# proc_name = None
|
||||
# default_proc_name = "backoffice"
|
||||
|
||||
""" SSL https://docs.gunicorn.org/en/stable/settings.html#ssl """
|
||||
# keyfile = None
|
||||
# certfile = None
|
||||
# ssl_version = 2
|
||||
# cert_reqs = 0
|
||||
# ca_certs = None
|
||||
# suppress_ragged_eofs = True
|
||||
# do_handshake_on_connect = False
|
||||
# ciphers = None
|
||||
|
||||
""" Security https://docs.gunicorn.org/en/stable/settings.html#security """
|
||||
# limit_request_line = 4094
|
||||
# limit_request_fields = 100
|
||||
# limit_request_field_size = 8190
|
||||
|
||||
""" Server Hooks https://docs.gunicorn.org/en/stable/settings.html#server-hooks """
|
||||
|
||||
|
||||
""" Server Mechanics https://docs.gunicorn.org/en/stable/settings.html#server-mechanics """
|
||||
# preload_app = False
|
||||
# sendfile = None
|
||||
# reuse_port = False
|
||||
chdir = "/app"
|
||||
# daemon = False
|
||||
# raw_env = []
|
||||
# pidfile = None
|
||||
# worker_tmp_dir = None
|
||||
# user = "django"
|
||||
# group = "django"
|
||||
# umask = 0
|
||||
# initgroups = False
|
||||
# tmp_upload_dir = None
|
||||
# secure_scheme_headers = {'X-FORWARDED-PROTOCOL': 'ssl', 'X-FORWARDED-PROTO': 'https', 'X-FORWARDED-SSL': 'on'}
|
||||
# forwarded_allow_ips = ['127.0.0.1']
|
||||
# pythonpath = None
|
||||
# paste = None
|
||||
# proxy_protocol = False
|
||||
# proxy_allow_ips = ['127.0.0.1']
|
||||
# raw_paste_global_conf = []
|
||||
# strip_header_spaces = False
|
||||
|
||||
""" Server Socket https://docs.gunicorn.org/en/stable/settings.html#server-socket """
|
||||
bind = "0.0.0.0:5000"
|
||||
# backlog = 2048
|
||||
|
||||
""" Worker Processes https://docs.gunicorn.org/en/stable/settings.html#worker-processes """
|
||||
workers = 2
|
||||
# worker_class = "sync"
|
||||
threads = 2
|
||||
# worker_connections = 1000
|
||||
# max_requests = 0
|
||||
# max_requests_jitter = 0
|
||||
# timeout = 30
|
||||
# graceful_timeout = 30
|
||||
# keepalive = 2
|
17
pyproject.toml
Normal file
17
pyproject.toml
Normal file
@ -0,0 +1,17 @@
|
||||
[tool.black]
|
||||
line-length = 120
|
||||
target-version = ['py311']
|
||||
include = '\.pyi?$'
|
||||
extend-exclude = '''(
|
||||
migrations/*
|
||||
| .git/*
|
||||
| media/*
|
||||
)'''
|
||||
workers = 4
|
||||
|
||||
|
||||
[tool.isort]
|
||||
profile = "black"
|
||||
line_length = 120
|
||||
skip = ["venv", "templates", ".git"]
|
||||
multi_line_output = 3
|
@ -1,3 +1,4 @@
|
||||
Flask==2.2.2
|
||||
icalendar==5.0.1
|
||||
unidecode==1.3.6
|
||||
Flask==3.0.0
|
||||
icalendar==5.0.11
|
||||
Unidecode==1.3.7
|
||||
Gunicorn==21.2.0
|
||||
|
13
setup.cfg
Normal file
13
setup.cfg
Normal file
@ -0,0 +1,13 @@
|
||||
[flake8]
|
||||
max-line-length = 120
|
||||
exclude = .git,venv
|
||||
ignore = E203,E262,E265,E501,E722,E741,W503,W605,F405,F841,F401
|
||||
|
||||
[mypy]
|
||||
python_version = 3.11
|
||||
check_untyped_defs = True
|
||||
ignore_missing_imports = True
|
||||
warn_unused_ignores = True
|
||||
warn_redundant_casts = True
|
||||
warn_unused_configs = True
|
||||
|
Reference in New Issue
Block a user