aboutsummaryrefslogtreecommitdiff
path: root/web_interface
diff options
context:
space:
mode:
authoruser@node5.net <user@node5.net>2025-12-06 23:33:49 +0100
committeruser@node5.net <user@node5.net>2025-12-06 23:33:49 +0100
commit57101c8308f1eb75d14d019a781c5a7597eb04fe (patch)
treeea80ca74decf5d7ea6d2678a4ca43b492b2f604d /web_interface
parent1307490faef6014ebdf7122dc5044fa5f906555c (diff)
WebInterface - Initialize django stub & setup instructions
Diffstat (limited to 'web_interface')
-rw-r--r--web_interface/Makefile16
-rw-r--r--web_interface/README.md8
-rw-r--r--web_interface/drinks_machine/__init__.py0
-rw-r--r--web_interface/drinks_machine/asgi.py16
-rw-r--r--web_interface/drinks_machine/settings.py117
-rw-r--r--web_interface/drinks_machine/urls.py22
-rw-r--r--web_interface/drinks_machine/wsgi.py16
-rwxr-xr-xweb_interface/manage.py22
-rw-r--r--web_interface/pyproject.toml18
-rw-r--r--web_interface/shell.nix11
-rw-r--r--web_interface/uv.lock56
11 files changed, 302 insertions, 0 deletions
diff --git a/web_interface/Makefile b/web_interface/Makefile
new file mode 100644
index 0000000..b5104fa
--- /dev/null
+++ b/web_interface/Makefile
@@ -0,0 +1,16 @@
+.PHONY: venv install run_dev
+
+VENV_DIR = venv
+PYTHON = python3
+
+# Default target
+all: install migrate run_dev
+
+install:
+ uv sync
+
+migrate:
+ uv run manage.py migrate
+
+run_dev:
+ uv run manage.py runserver
diff --git a/web_interface/README.md b/web_interface/README.md
new file mode 100644
index 0000000..1bb0eac
--- /dev/null
+++ b/web_interface/README.md
@@ -0,0 +1,8 @@
+# Drinks machine - Web interface
+
+## Setup & running
+
+### Dev setup & running
+
+1. [Download nix](https://nixos.org/download/)
+2. Run: `nix-shell --command make`
diff --git a/web_interface/drinks_machine/__init__.py b/web_interface/drinks_machine/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/web_interface/drinks_machine/__init__.py
diff --git a/web_interface/drinks_machine/asgi.py b/web_interface/drinks_machine/asgi.py
new file mode 100644
index 0000000..c4af364
--- /dev/null
+++ b/web_interface/drinks_machine/asgi.py
@@ -0,0 +1,16 @@
+"""
+ASGI config for drinks_machine 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/6.0/howto/deployment/asgi/
+"""
+
+import os
+
+from django.core.asgi import get_asgi_application
+
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'drinks_machine.settings')
+
+application = get_asgi_application()
diff --git a/web_interface/drinks_machine/settings.py b/web_interface/drinks_machine/settings.py
new file mode 100644
index 0000000..a851434
--- /dev/null
+++ b/web_interface/drinks_machine/settings.py
@@ -0,0 +1,117 @@
+"""
+Django settings for drinks_machine project.
+
+Generated by 'django-admin startproject' using Django 6.0.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/6.0/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/6.0/ref/settings/
+"""
+
+from pathlib import Path
+
+# Build paths inside the project like this: BASE_DIR / 'subdir'.
+BASE_DIR = Path(__file__).resolve().parent.parent
+
+
+# Quick-start development settings - unsuitable for production
+# See https://docs.djangoproject.com/en/6.0/howto/deployment/checklist/
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = 'django-insecure-m(z7kz1$nf)4r^uu^0t#o4&5kxvvotpw0#!e(^=womt&4e=@^8'
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = True
+
+ALLOWED_HOSTS = []
+
+
+# Application definition
+
+INSTALLED_APPS = [
+ 'django.contrib.admin',
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.messages',
+ 'django.contrib.staticfiles',
+]
+
+MIDDLEWARE = [
+ 'django.middleware.security.SecurityMiddleware',
+ 'django.contrib.sessions.middleware.SessionMiddleware',
+ 'django.middleware.common.CommonMiddleware',
+ 'django.middleware.csrf.CsrfViewMiddleware',
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
+ 'django.contrib.messages.middleware.MessageMiddleware',
+ 'django.middleware.clickjacking.XFrameOptionsMiddleware',
+]
+
+ROOT_URLCONF = 'drinks_machine.urls'
+
+TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'DIRS': [],
+ 'APP_DIRS': True,
+ 'OPTIONS': {
+ 'context_processors': [
+ 'django.template.context_processors.request',
+ 'django.contrib.auth.context_processors.auth',
+ 'django.contrib.messages.context_processors.messages',
+ ],
+ },
+ },
+]
+
+WSGI_APPLICATION = 'drinks_machine.wsgi.application'
+
+
+# Database
+# https://docs.djangoproject.com/en/6.0/ref/settings/#databases
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': BASE_DIR / 'db.sqlite3',
+ }
+}
+
+
+# Password validation
+# https://docs.djangoproject.com/en/6.0/ref/settings/#auth-password-validators
+
+AUTH_PASSWORD_VALIDATORS = [
+ {
+ 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
+ },
+]
+
+
+# Internationalization
+# https://docs.djangoproject.com/en/6.0/topics/i18n/
+
+LANGUAGE_CODE = 'en-us'
+
+TIME_ZONE = 'UTC'
+
+USE_I18N = True
+
+USE_TZ = True
+
+
+# Static files (CSS, JavaScript, Images)
+# https://docs.djangoproject.com/en/6.0/howto/static-files/
+
+STATIC_URL = 'static/'
diff --git a/web_interface/drinks_machine/urls.py b/web_interface/drinks_machine/urls.py
new file mode 100644
index 0000000..fee8c11
--- /dev/null
+++ b/web_interface/drinks_machine/urls.py
@@ -0,0 +1,22 @@
+"""
+URL configuration for drinks_machine project.
+
+The `urlpatterns` list routes URLs to views. For more information please see:
+ https://docs.djangoproject.com/en/6.0/topics/http/urls/
+Examples:
+Function views
+ 1. Add an import: from my_app import views
+ 2. Add a URL to urlpatterns: path('', views.home, name='home')
+Class-based views
+ 1. Add an import: from other_app.views import Home
+ 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
+Including another URLconf
+ 1. Import the include() function: from django.urls import include, path
+ 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
+"""
+from django.contrib import admin
+from django.urls import path
+
+urlpatterns = [
+ path('admin/', admin.site.urls),
+]
diff --git a/web_interface/drinks_machine/wsgi.py b/web_interface/drinks_machine/wsgi.py
new file mode 100644
index 0000000..a5d2224
--- /dev/null
+++ b/web_interface/drinks_machine/wsgi.py
@@ -0,0 +1,16 @@
+"""
+WSGI config for drinks_machine project.
+
+It exposes the WSGI callable as a module-level variable named ``application``.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/6.0/howto/deployment/wsgi/
+"""
+
+import os
+
+from django.core.wsgi import get_wsgi_application
+
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'drinks_machine.settings')
+
+application = get_wsgi_application()
diff --git a/web_interface/manage.py b/web_interface/manage.py
new file mode 100755
index 0000000..57cbb60
--- /dev/null
+++ b/web_interface/manage.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+"""Django's command-line utility for administrative tasks."""
+import os
+import sys
+
+
+def main():
+ """Run administrative tasks."""
+ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'drinks_machine.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)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/web_interface/pyproject.toml b/web_interface/pyproject.toml
new file mode 100644
index 0000000..b35c04e
--- /dev/null
+++ b/web_interface/pyproject.toml
@@ -0,0 +1,18 @@
+[project]
+name = "drinks-machine"
+version = "0.1.0"
+dependencies = [
+ "Django==6.0",
+]
+requires-python = ">=3.12"
+authors = [
+]
+maintainers = [
+]
+description = "Webinterface for the drinks machine"
+readme = "README.md"
+
+[project.optional-dependencies]
+dev = [
+]
+
diff --git a/web_interface/shell.nix b/web_interface/shell.nix
new file mode 100644
index 0000000..4db64fe
--- /dev/null
+++ b/web_interface/shell.nix
@@ -0,0 +1,11 @@
+{ pkgs ? import <nixpkgs> {} }:
+
+pkgs.mkShell {
+ buildInputs = [
+ pkgs.uv
+ pkgs.python314
+ ];
+
+ shellHook = ''
+ '';
+}
diff --git a/web_interface/uv.lock b/web_interface/uv.lock
new file mode 100644
index 0000000..c0e0b3d
--- /dev/null
+++ b/web_interface/uv.lock
@@ -0,0 +1,56 @@
+version = 1
+revision = 2
+requires-python = ">=3.12"
+
+[[package]]
+name = "asgiref"
+version = "3.11.0"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/76/b9/4db2509eabd14b4a8c71d1b24c8d5734c52b8560a7b1e1a8b56c8d25568b/asgiref-3.11.0.tar.gz", hash = "sha256:13acff32519542a1736223fb79a715acdebe24286d98e8b164a73085f40da2c4", size = 37969, upload-time = "2025-11-19T15:32:20.106Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/91/be/317c2c55b8bbec407257d45f5c8d1b6867abc76d12043f2d3d58c538a4ea/asgiref-3.11.0-py3-none-any.whl", hash = "sha256:1db9021efadb0d9512ce8ffaf72fcef601c7b73a8807a1bb2ef143dc6b14846d", size = 24096, upload-time = "2025-11-19T15:32:19.004Z" },
+]
+
+[[package]]
+name = "django"
+version = "6.0"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "asgiref" },
+ { name = "sqlparse" },
+ { name = "tzdata", marker = "sys_platform == 'win32'" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/15/75/19762bfc4ea556c303d9af8e36f0cd910ab17dff6c8774644314427a2120/django-6.0.tar.gz", hash = "sha256:7b0c1f50c0759bbe6331c6a39c89ae022a84672674aeda908784617ef47d8e26", size = 10932418, upload-time = "2025-12-03T16:26:21.878Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/d7/ae/f19e24789a5ad852670d6885f5480f5e5895576945fcc01817dfd9bc002a/django-6.0-py3-none-any.whl", hash = "sha256:1cc2c7344303bbfb7ba5070487c17f7fc0b7174bbb0a38cebf03c675f5f19b6d", size = 8339181, upload-time = "2025-12-03T16:26:16.231Z" },
+]
+
+[[package]]
+name = "drinks-machine"
+version = "0.1.0"
+source = { virtual = "." }
+dependencies = [
+ { name = "django" },
+]
+
+[package.metadata]
+requires-dist = [{ name = "django", specifier = "==6.0" }]
+provides-extras = ["dev"]
+
+[[package]]
+name = "sqlparse"
+version = "0.5.4"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/18/67/701f86b28d63b2086de47c942eccf8ca2208b3be69715a1119a4e384415a/sqlparse-0.5.4.tar.gz", hash = "sha256:4396a7d3cf1cd679c1be976cf3dc6e0a51d0111e87787e7a8d780e7d5a998f9e", size = 120112, upload-time = "2025-11-28T07:10:18.377Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/25/70/001ee337f7aa888fb2e3f5fd7592a6afc5283adb1ed44ce8df5764070f22/sqlparse-0.5.4-py3-none-any.whl", hash = "sha256:99a9f0314977b76d776a0fcb8554de91b9bb8a18560631d6bc48721d07023dcb", size = 45933, upload-time = "2025-11-28T07:10:19.73Z" },
+]
+
+[[package]]
+name = "tzdata"
+version = "2025.2"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/95/32/1a225d6164441be760d75c2c42e2780dc0873fe382da3e98a2e1e48361e5/tzdata-2025.2.tar.gz", hash = "sha256:b60a638fcc0daffadf82fe0f57e53d06bdec2f36c4df66280ae79bce6bd6f2b9", size = 196380, upload-time = "2025-03-23T13:54:43.652Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/5c/23/c7abc0ca0a1526a0774eca151daeb8de62ec457e77262b66b359c3c7679e/tzdata-2025.2-py2.py3-none-any.whl", hash = "sha256:1a403fada01ff9221ca8044d701868fa132215d84beb92242d9acd2147f667a8", size = 347839, upload-time = "2025-03-23T13:54:41.845Z" },
+]