Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update codebase #280

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
e2119c0
Created basic setup for development environment
seitztimo Dec 7, 2023
54dcc46
VSCode configuration
seitztimo Dec 8, 2023
efed701
Upgrade docker environment
seitztimo Dec 8, 2023
7447ee2
Update gitignore
seitztimo Dec 8, 2023
f289821
Update requirements.txt with Ubuntu 22.04 versions
seitztimo Dec 8, 2023
ee0e999
Remove old reference from devcontainer name
seitztimo Dec 8, 2023
7215eda
Update django version to 4.2.8 (.txt) and 4.2(.in).
terhisalonen Dec 11, 2023
160ad2f
Replace ugettext_lazy with gettext_lazy.
terhisalonen Dec 11, 2023
b6c57ad
Replace url with re_path.
terhisalonen Dec 11, 2023
c4af015
Replace more url with re_path.
terhisalonen Dec 11, 2023
15a1b04
Update djangorestframework version.
terhisalonen Dec 11, 2023
fa42440
Upgraded package versions in requirements.in
seitztimo Dec 12, 2023
0978684
Ran pip-compile for requirements
seitztimo Dec 12, 2023
89a8c77
Allow users in docker file to run administrative commands
seitztimo Dec 12, 2023
4e2f027
Added no-install-recommends for apt-get isntall
seitztimo Dec 12, 2023
2628408
Ran pip-compile also for development libraries
seitztimo Dec 12, 2023
395c659
Added steps to isntall build tool for readme
seitztimo Dec 12, 2023
197845b
Merge upgraded packages into test.
terhisalonen Dec 12, 2023
c8e9272
Update Django version to 4.2.8
terhisalonen Dec 12, 2023
57044f0
Upgrade djangorestframework from 3.11.1 to 3.14.0.
terhisalonen Dec 12, 2023
cc885da
Change 'from django.contrib.postgres.fields import JSONField' to 'fro…
terhisalonen Dec 13, 2023
f94dfeb
Update 'url' to 're_path' for parkings/api/auth.
terhisalonen Dec 13, 2023
a62bb00
Update 'url' to 're_path' for parkings/api/auth.
terhisalonen Dec 13, 2023
43cd84a
Resolve more cases of deprecated ugettext, ugettext_lazy and smart_text.
terhisalonen Dec 13, 2023
027127d
Upgrade packages for testing.
terhisalonen Dec 13, 2023
c23d8cf
Add format convertion for values 'time_start' and 'time_end'.
terhisalonen Dec 14, 2023
024dbb8
Fix datetime formatting for valid permit item.
terhisalonen Dec 14, 2023
ff24357
Fix time_start and time_end formating.
terhisalonen Dec 14, 2023
7dc3934
Upgrade pytz and tzdata.
terhisalonen Dec 15, 2023
89061eb
Fix typeError: encoding without a string argument.
terhisalonen Dec 20, 2023
4e1692f
Update test to format 'time_start' and 'time_end' with iso8601_us fun…
terhisalonen Dec 22, 2023
7bcd845
Fix typo.
terhisalonen Dec 22, 2023
c26a7bf
Update the expected result to match the accuracy level of the assert …
terhisalonen Dec 27, 2023
5309734
Update the html expression to include the attribute, which is found i…
terhisalonen Dec 27, 2023
f5c7946
Remove error-leading white space from the assert expression.
terhisalonen Dec 27, 2023
959cffa
Remove obsolete comments.
terhisalonen Dec 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "ParkkiHubi",
"dockerComposeFile": [
"../docker-compose.yml",
"docker-compose.yml"
],
"service": "runserver",
"workspaceFolder": "/home/bew/bew",
"runServices": [
"runserver",
"postgresql",
"memcached"
],
"shutdownAction": "stopCompose",
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"donjayamanne.githistory",
"eamodio.gitlens",
"davidanson.vscode-markdownlint",
"dakara.transformer"
]
}
},
"postCreateCommand": "cp -n local_settings.py.tpl_dev local_settings.py"
}
5 changes: 5 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
version: '3'
services:
runserver:
command: /bin/sh -c "while sleep 1000; do :; done"
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ tags
# Linux trash folder which might appear on any partition or disk
.Trash-*

# User files
.ssh

# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### macOS template
Expand Down Expand Up @@ -56,6 +59,7 @@ Temporary Items
__pycache__/
*.py[cod]
*$py.class
*.pyc

# C extensions
*.so
Expand Down Expand Up @@ -107,6 +111,9 @@ coverage.xml
# Django stuff:
*.log
local_settings.py
mediaroot/
staticroot/
database.db

# Flask stuff:
instance/
Expand Down Expand Up @@ -201,6 +208,9 @@ fabric.properties
Thumbs.db
ehthumbs.db

# New Relic configuration file
newrelic.ini

# Folder config file
Desktop.ini

Expand Down
86 changes: 86 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Django: Runserver",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
"runserver",
"0.0.0.0:8000"
],
"django": true,
"justMyCode": false,
"subProcess": true
},
{
"name": "Django: Runserver - nonthreading",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
"runserver",
"--nothreading",
"0.0.0.0:8000"
],
"django": true,
"justMyCode": false,
"subProcess": true
},
{
"name": "Django: Shell",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
"shell"
],
"django": true,
"justMyCode": false
},
{
"name": "Django: Migrate",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
"migrate"
],
"django": true,
"justMyCode": false
},
{
"name": "Django: Make migrations",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
"makemigrations"
],
"django": true,
"justMyCode": false
},
{
"name": "Django: Collectstatic",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
"collectstatic",
"--no-input"
],
"django": true,
"justMyCode": false
},
{
"name": "Run pytest",
"type": "python",
"request": "launch",
"module": "pytest",
"args": [],
"django": true,
"justMyCode": false
}
]
}
17 changes: 17 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"python.defaultInterpreterPath": "../.venv/bin/python3",
"git.autofetch": true,
"git.autoStash": true,
"git.fetchOnPull": true,
"editor.renderWhitespace": "all",
"editor.renderControlCharacters": true,
"files.trimTrailingWhitespace": true,
"zenMode.hideLineNumbers": false,
"zenMode.centerLayout": false,
"zenMode.fullScreen": false,
"gitlens.codeLens.enabled": false,
"gitlens.currentLine.enabled": false,
"[python]": {
"editor.tabSize": 2
}
}
98 changes: 50 additions & 48 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,48 +1,50 @@
FROM python:3.7-slim as appbase

ENV PYTHONBUFFERED 1

RUN apt-get update \
&& \
apt-get install --no-install-recommends -y \
gdal-bin \
python3-gdal \
netcat \
libpq-dev \
build-essential

WORKDIR /app

COPY requirements.txt ./requirements.txt

RUN pip install --no-cache-dir -r requirements.txt \
&& \
apt-get remove -y build-essential libpq-dev \
&& \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& \
rm -rf /var/lib/apt/lists/* \
&& \
rm -rf /var/cache/apt/archives


COPY . .

ENTRYPOINT ["/app/django-entrypoint.sh"]

# TODO: Production environment
# Production environment
# CMD ["production"]


# Development environment
FROM appbase as development

COPY requirements-*.txt ./

RUN pip install --no-cache-dir \
-r requirements-dev.txt \
-r requirements-style.txt \
-r requirements-test.txt

CMD ["development"]
FROM ubuntu:jammy-20231004

ENV USER=root DEBIAN_FRONTEND=noninteractive
VOLUME ["/var/cache/apt/archives"]
RUN touch /.dockerenv

RUN apt-get update \
&& apt-get install --yes \
git \
sudo \
vim \
zsh \
&& echo '%sudo ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/sudo_nopasswd \
&& apt-get install --yes --no-install-recommends \
gdal-bin \
python3 \
python3-cryptography \
python3-lxml \
python3-memcache \
python3-ndg-httpsclient \
python3-paste \
python3-pil \
python3-pip \
python3-psycopg2 \
python3-pyasn1 \
python3-pyproj \
python3-rcssmin \
python3-requests \
python3-six \
python3-socks \
python3-urllib3 \
python3-venv \
python3-wheel

RUN useradd -m -u 1000 bew
RUN usermod -aG sudo -s /usr/bin/zsh bew
COPY zshrc /home/bew/.zshrc
RUN chown -R bew:bew /home/bew

USER bew
ENV USER=bew
ENV PYTHONDONTWRITEBYTECODE=1
WORKDIR /home/bew/bew

COPY --chown=bew:bew . /home/bew/bew/

RUN python3.10 -m venv --system-site-packages /home/bew/.venv
RUN /home/bew/.venv/bin/pip3 install -r /home/bew/bew/requirements.txt

CMD /bin/zsh
Loading