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

Upgrade Django to v5; related work and cleanups #339

Draft
wants to merge 40 commits into
base: production
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
f7f7012
Cursory implementation of poetry to ease development and use by other…
anadon May 30, 2024
c1c3c23
Added poetry setup.
anadon Jul 14, 2024
5676583
Taking upstream Dockerfile.
anadon Nov 24, 2024
8312d54
Altered the project to automatically configure and enter a reproducib…
anadon Nov 24, 2024
91d7671
Adding assests for Furpoc templates.
anadon Nov 24, 2024
4d9fa96
Checking in work. Quashed most of the deprication issues preventing …
anadon Dec 23, 2024
662c406
Added ruff.
anadon Dec 23, 2024
34a51fa
Fixes a missed deprecation issue.
anadon Dec 23, 2024
b28b9b8
No longer tracking migrations since those are auto-generated.
anadon Dec 23, 2024
4d59be7
No longer tracking migrations since those are auto-generated.
anadon Dec 23, 2024
5f02ba8
Formatted with ruff.
anadon Dec 23, 2024
d56f714
Safe fixes applied by ruff.
anadon Dec 23, 2024
47730ca
add signature capture to web form (#323)
meanderfox Jul 25, 2024
4dbb290
Added poetry setup.
anadon Jul 14, 2024
2692996
update various documentation (#320)
meanderfox May 31, 2024
882aa39
registration form (#305)
meanderfox Jul 1, 2024
6303097
clearer closed messages (#322)
meanderfox Jul 2, 2024
d840e64
update styling (#324)
meanderfox Jul 16, 2024
6c2123c
add signature capture to web form (#323)
meanderfox Jul 25, 2024
5bdda27
Update staff-closed.html (#326)
meanderfox Jul 30, 2024
118310f
update actions version (#325)
meanderfox Aug 16, 2024
6684e7b
Shore up check for already received webhook (#329)
rechner Aug 27, 2024
d27acb6
Add syntax highlighted JSON field output in webhook admin (#327)
rechner Aug 27, 2024
333a168
Billing data State field actually optional (#330)
rechner Sep 6, 2024
e62eb7b
remove buttons for a cause (#331)
meanderfox Sep 6, 2024
89055bd
Update admin.py (#328)
meanderfox Sep 6, 2024
581303f
good enough (#332)
meanderfox Sep 26, 2024
257d558
Make dealer wifi configurable, form tweaks. Update pre-commit (#333)
rechner Oct 18, 2024
0794b67
Add Gotenberg as option in addition to wkhtmltopdf (#336)
Syfaro Nov 15, 2024
11f3bd1
Altered the project to automatically configure and enter a reproducib…
anadon Nov 24, 2024
a678bce
Adding assests for Furpoc templates.
anadon Nov 24, 2024
d05f334
Checking in work. Quashed most of the deprication issues preventing …
anadon Dec 23, 2024
3806f10
Added ruff.
anadon Dec 23, 2024
30d27ae
Fixes a missed deprecation issue.
anadon Dec 23, 2024
a915b81
No longer tracking migrations since those are auto-generated.
anadon Dec 23, 2024
7ec8679
No longer tracking migrations since those are auto-generated.
anadon Dec 23, 2024
9a90de4
Formatted with ruff.
anadon Dec 23, 2024
976d237
Safe fixes applied by ruff.
anadon Dec 23, 2024
daf3f0e
add signature capture to web form (#323)
meanderfox Jul 25, 2024
ae6cf45
Merge remote-tracking branch 'refs/remotes/origin/poetry-setup' into …
anadon Dec 23, 2024
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
38 changes: 38 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Modified from the Direnv wiki entry for Poetry
# It has been adjusted to check for files more thoroughly and if they are missing request corrective action.
deploy_poetry() {
PYPROJECT_TOML="${PYPROJECT_TOML:-pyproject.toml}"
if [[ ! -f "$PYPROJECT_TOML" ]]; then
log_status "No pyproject.toml found. Run \`poetry init\` manually to create a \`$PYPROJECT_TOML\` first."
return
fi

if [[ -d ".venv" ]]; then
VIRTUAL_ENV="$(pwd)/.venv"
else
VIRTUAL_ENV=$(poetry env info --path 2>/dev/null ; true)
fi

if [[ -z $VIRTUAL_ENV || ! -d $VIRTUAL_ENV ]]; then
log_status "No virtual environment exists. Executing \`poetry install\` to create one."
poetry install
VIRTUAL_ENV=$(poetry env info --path)
fi

PATH_add "$VIRTUAL_ENV/bin"
export POETRY_ACTIVE=1 # or VENV_ACTIVE=1
export VIRTUAL_ENV

LOCKFILE_OK=$(poetry check --lock 2>&1 /dev/null ; true)
if [[ -z LOCKFILE_OK ]]; then
poetry lock --no-update
fi

poetry install --sync
}

# Install packages from Nix and setup some of the development environment
use flake

# Install Python specific modules modules related to Poetry
deploy_poetry
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ test-db.sqlite3
registration/resources/nametag/apis/tmp*.html
.idea/
.coverage
.envrc
fm_eventmanager/maintenance_mode_state.txt
localhost.crt
localhost.key
venv3/
.env
htmlcov/
.DS_Store
.direnv/
registration/migrations/

26 changes: 26 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 49 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
description = "Define development dependencies.";

inputs = {
# Which Nix upstream package branch to track
nixpkgs.url = "nixpkgs/nixos-unstable";
};

# What results we're going to expose
outputs = { self, nixpkgs }:
let
# What packages and system functions we'll use
pkgs = import nixpkgs { system = "x86_64-linux"; };
# What version of Python we're going to explicitly track
# NOTE: This doesn't explicitly track with what is in packages and so
# will break at some point in the future.
python_name = "python3.12";
python = pkgs.python312;
in {

# Declare what packages we need as a record. The use as a record is
# needed because, without it, the data contained within can't be
# referenced in other parts of this file.
devShells.x86_64-linux.default = pkgs.mkShell rec {
packages = with pkgs; [
python3Full
(poetry.override { python3 = python; })
direnv
gcc-unwrapped
stdenv
wkhtmltopdf
postgresql
ruff
# NOTE: Put additional packages you need in this array. Packages may be found by looking them up in
# https://search.nixos.org/packages
];

# Getting the library paths needed for Python to be put into
# LD_LIBRARY_PATH
pythonldlibpath = "${pkgs.stdenv.cc.cc.lib}/lib:${pkgs.stdenv.cc.cc.lib.outPath}/lib:${pkgs.lib.makeLibraryPath packages}";

# Run the following on the shell, which builds up LD_LIBRARY_PATH.
shellHook = ''
export LD_LIBRARY_PATH="${pythonldlibpath}"
'';

};
};
}
16 changes: 16 additions & 0 deletions fm_eventmanager/asgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
ASGI config for fm_eventmanager project.

It exposes the ASGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/
"""

import os

from django.core.asgi import get_asgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "fm_eventmanager.settings")

application = get_asgi_application()
24 changes: 13 additions & 11 deletions fm_eventmanager/urls.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
import django_u2f.urls
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import RedirectView
from django.http import HttpResponse
from django.urls import include, path
# import django_u2f.urls

admin.autodiscover()

urlpatterns = [
url(
r"robots.txt",
lambda x: HttpResponse("User-Agent: *\n\nDisallow: /", content_type="text/plain"),
name="robots_file"
path(
"robots.txt",
lambda x: HttpResponse(
"User-Agent: *\n\nDisallow: /", content_type="text/plain"
),
name="robots_file",
),
url(r"^registration/", include("registration.urls", namespace="registration")),
url(r"^admin/", admin.site.urls),
url(r"^u2f/", include(django_u2f.urls, namespace="u2f")),
url(r"^$", RedirectView.as_view(url="registration"), name="root"),
path("registration/", include("registration.urls", namespace="registration")),
path("admin/", admin.site.urls),
# path("u2f/", include(django_u2f.urls, namespace="u2f")),
path("", RedirectView.as_view(url="registration"), name="root"),
]

if settings.DEBUG:
import debug_toolbar

urlpatterns = [
url(r"^__debug__/", include(debug_toolbar.urls)),
path("__debug__/", include(debug_toolbar.urls)),
] + urlpatterns
19 changes: 16 additions & 3 deletions manage.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""

import os
import sys

if __name__ == "__main__":

def main():
"""Run administrative tasks."""
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "fm_eventmanager.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)

from django.core.management import execute_from_command_line

execute_from_command_line(sys.argv)
if __name__ == "__main__":
main()
Loading