Scaffold Django project and add first-run auth flow

Sets up the Evection project structure: split settings supporting both
SQLite and PostgreSQL via DATABASE_URL, Celery+Redis wiring, and the
planned app layout (accounts, feeds, articles, rules, search, reader,
pwa, core). Implements multi-user auth with a FreshRSS-style first-run
setup wizard, login/logout, and admin-only user management, covered by
automated tests.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
ksmithandClaude Sonnet 5 committed 2026-10-30 15:56:58 -06:00
1 parent 986206fe40
commit c635cd9330
84 files changed
+897

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
# Copy to .env and adjust for your environment.
# A long, random, secret value — never commit your real one.
SECRET_KEY=change-me-to-a-long-random-value
DEBUG=False
ALLOWED_HOSTS=localhost,127.0.0.1
# SQLite (default, zero-config):
DATABASE_URL=sqlite:///db.sqlite3
# Postgres:
# DATABASE_URL=postgres://evection:password@localhost:5432/evection
REDIS_URL=redis://localhost:6379/0
# Open account registration is off by default; the first account created via
# the setup wizard becomes the instance admin.
EVECTION_SIGNUP_ENABLED=False
# Global floor for any feed's polling interval, in minutes.
EVECTION_MIN_FETCH_INTERVAL_MINUTES=15
# Bump this on deploys that change cached static assets to invalidate old
# service worker caches.
EVECTION_PWA_CACHE_VERSION=v1
+13
View File
@@ -0,0 +1,13 @@
__pycache__/
*.py[cod]
*.sqlite3
.env
.venv/
venv/
staticfiles/
media/
*.egg-info/
.pytest_cache/
.ruff_cache/
.coverage
htmlcov/
+29
View File
@@ -0,0 +1,29 @@
# Evection
A self-hosted RSS/Atom feed reader, in the spirit of FreshRSS, built in Python
(Django) instead of PHP. Installable as a PWA on mobile.
Status: early scaffolding — auth and accounts are in place; feed fetching,
reading UI, search, rules, OPML, and the PWA layer are still to come.
## Development setup
```bash
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
cp .env.example .env
python manage.py migrate
python manage.py runserver
```
Visit `http://localhost:8000/` — you'll land on the first-run setup wizard to
create the instance's admin account.
## Tests
```bash
pytest
ruff check .
black --check .
```
View File
Whitespace-only changes.
View File
Whitespace-only changes.
+9
View File
@@ -0,0 +1,9 @@
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as DjangoUserAdmin
from .models import User
@admin.register(User)
class UserAdmin(DjangoUserAdmin):
fieldsets = DjangoUserAdmin.fieldsets + (("Evection", {"fields": ("timezone",)}),)
+6
View File
@@ -0,0 +1,6 @@
from django.apps import AppConfig
class AccountsConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "apps.accounts"
+30
View File
@@ -0,0 +1,30 @@
from django import forms
from django.contrib.auth.forms import UsernameField
from .models import User
class SetupForm(forms.ModelForm):
password = forms.CharField(widget=forms.PasswordInput, min_length=8)
password_confirm = forms.CharField(widget=forms.PasswordInput, min_length=8)
class Meta:
model = User
fields = ["username", "email"]
field_classes = {"username": UsernameField}
def clean(self):
cleaned_data = super().clean()
if cleaned_data.get("password") != cleaned_data.get("password_confirm"):
raise forms.ValidationError("Passwords do not match.")
return cleaned_data
class CreateUserForm(forms.ModelForm):
password = forms.CharField(widget=forms.PasswordInput, min_length=8)
class Meta:
model = User
fields = ["username", "email", "is_staff"]
field_classes = {"username": UsernameField}
labels = {"is_staff": "Grant admin access"}
+33
View File
@@ -0,0 +1,33 @@
from django.conf import settings
from django.shortcuts import redirect
from django.urls import reverse
from .models import User
_SETUP_EXEMPT_PREFIXES = (settings.STATIC_URL,)
class SetupWizardMiddleware:
"""Force every request to the first-run setup wizard until an account exists.
Once any User row exists, /setup/ becomes unreachable again (see the
setup view), mirroring FreshRSS's one-time install wizard. The "a user
exists" check only ever flips false -> true for the lifetime of an
instance, so it's cached per-process after the first positive result to
avoid a query on every request.
"""
_a_user_exists = False
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
path = request.path
if not path.startswith(_SETUP_EXEMPT_PREFIXES):
if not SetupWizardMiddleware._a_user_exists:
SetupWizardMiddleware._a_user_exists = User.objects.exists()
setup_url = reverse("accounts:setup")
if path != setup_url and not SetupWizardMiddleware._a_user_exists:
return redirect(setup_url)
return self.get_response(request)
+119
View File
@@ -0,0 +1,119 @@
# Generated by Django 5.2.18 on 2026-10-30 00:01
import django.contrib.auth.models
import django.contrib.auth.validators
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
("auth", "0012_alter_user_first_name_max_length"),
]
operations = [
migrations.CreateModel(
name="User",
fields=[
(
"id",
models.BigAutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
("password", models.CharField(max_length=128, verbose_name="password")),
(
"last_login",
models.DateTimeField(blank=True, null=True, verbose_name="last login"),
),
(
"is_superuser",
models.BooleanField(
default=False,
help_text="Designates that this user has all permissions without explicitly assigning them.",
verbose_name="superuser status",
),
),
(
"username",
models.CharField(
error_messages={"unique": "A user with that username already exists."},
help_text="Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.",
max_length=150,
unique=True,
validators=[django.contrib.auth.validators.UnicodeUsernameValidator()],
verbose_name="username",
),
),
(
"first_name",
models.CharField(blank=True, max_length=150, verbose_name="first name"),
),
(
"last_name",
models.CharField(blank=True, max_length=150, verbose_name="last name"),
),
(
"email",
models.EmailField(blank=True, max_length=254, verbose_name="email address"),
),
(
"is_staff",
models.BooleanField(
default=False,
help_text="Designates whether the user can log into this admin site.",
verbose_name="staff status",
),
),
(
"is_active",
models.BooleanField(
default=True,
help_text="Designates whether this user should be treated as active. Unselect this instead of deleting accounts.",
verbose_name="active",
),
),
(
"date_joined",
models.DateTimeField(
default=django.utils.timezone.now, verbose_name="date joined"
),
),
("timezone", models.CharField(default="UTC", max_length=64)),
("created_at", models.DateTimeField(auto_now_add=True)),
(
"groups",
models.ManyToManyField(
blank=True,
help_text="The groups this user belongs to. A user will get all permissions granted to each of their groups.",
related_name="user_set",
related_query_name="user",
to="auth.group",
verbose_name="groups",
),
),
(
"user_permissions",
models.ManyToManyField(
blank=True,
help_text="Specific permissions for this user.",
related_name="user_set",
related_query_name="user",
to="auth.permission",
verbose_name="user permissions",
),
),
],
options={
"verbose_name": "user",
"verbose_name_plural": "users",
"abstract": False,
},
managers=[
("objects", django.contrib.auth.models.UserManager()),
],
),
]
Whitespace-only changes.
+7
View File
@@ -0,0 +1,7 @@
from django.contrib.auth.models import AbstractUser
from django.db import models
class User(AbstractUser):
timezone = models.CharField(max_length=64, default="UTC")
created_at = models.DateTimeField(auto_now_add=True)
+92
View File
@@ -0,0 +1,92 @@
import pytest
from django.urls import reverse
from .middleware import SetupWizardMiddleware
from .models import User
@pytest.fixture(autouse=True)
def _reset_setup_wizard_cache():
SetupWizardMiddleware._a_user_exists = False
yield
SetupWizardMiddleware._a_user_exists = False
@pytest.mark.django_db
def test_root_redirects_to_setup_when_no_users_exist(client):
response = client.get("/", follow=False)
assert response.status_code == 302
assert response.url == reverse("accounts:setup")
@pytest.mark.django_db
def test_setup_creates_admin_and_logs_in(client):
response = client.post(
reverse("accounts:setup"),
{
"username": "keith",
"email": "keith@example.com",
"password": "correct-horse-battery",
"password_confirm": "correct-horse-battery",
},
)
assert response.status_code == 302
assert response.url == reverse("reader:stream")
user = User.objects.get(username="keith")
assert user.is_staff
assert user.is_superuser
stream_response = client.get(reverse("reader:stream"))
assert stream_response.status_code == 200
@pytest.mark.django_db
def test_setup_is_unreachable_once_a_user_exists(client):
User.objects.create_user("existing", password="irrelevant")
response = client.get(reverse("accounts:setup"))
assert response.status_code == 302
assert response.url == reverse("accounts:login")
@pytest.mark.django_db
def test_setup_rejects_mismatched_passwords(client):
response = client.post(
reverse("accounts:setup"),
{
"username": "keith",
"email": "keith@example.com",
"password": "correct-horse-battery",
"password_confirm": "does-not-match",
},
)
assert response.status_code == 200
assert not User.objects.exists()
@pytest.mark.django_db
def test_non_admin_cannot_manage_users(client):
User.objects.create_user("regular", password="pw-regular-123")
client.login(username="regular", password="pw-regular-123")
response = client.get(reverse("accounts:manage_users"))
assert response.status_code == 302 # user_passes_test redirects non-staff
@pytest.mark.django_db
def test_admin_can_create_user(client):
admin = User.objects.create_user("admin", password="pw-admin-123", is_staff=True)
client.login(username="admin", password="pw-admin-123")
response = client.post(
reverse("accounts:create_user"),
{
"username": "newperson",
"email": "newperson@example.com",
"password": "pw-newperson-123",
},
)
assert response.status_code == 302
assert User.objects.filter(username="newperson").exists()
assert admin.pk # sanity: fixture user untouched
+18
View File
@@ -0,0 +1,18 @@
from django.contrib.auth import views as auth_views
from django.urls import path
from . import views
app_name = "accounts"
urlpatterns = [
path("setup/", views.setup, name="setup"),
path(
"login/",
auth_views.LoginView.as_view(template_name="accounts/login.html"),
name="login",
),
path("logout/", auth_views.LogoutView.as_view(), name="logout"),
path("users/", views.manage_users, name="manage_users"),
path("users/create/", views.create_user, name="create_user"),
]
+47
View File
@@ -0,0 +1,47 @@
from django.contrib import messages
from django.contrib.auth import login
from django.contrib.auth.decorators import user_passes_test
from django.shortcuts import redirect, render
from .forms import CreateUserForm, SetupForm
from .middleware import SetupWizardMiddleware
from .models import User
is_admin = user_passes_test(lambda u: u.is_authenticated and u.is_staff)
def setup(request):
if User.objects.exists():
return redirect("accounts:login")
form = SetupForm(request.POST or None)
if request.method == "POST" and form.is_valid():
user = form.save(commit=False)
user.set_password(form.cleaned_data["password"])
user.is_staff = True
user.is_superuser = True
user.save()
SetupWizardMiddleware._a_user_exists = True
login(request, user)
messages.success(request, "Welcome to Evection! Your admin account is ready.")
return redirect("reader:stream")
return render(request, "accounts/setup.html", {"form": form})
@is_admin
def manage_users(request):
users = User.objects.order_by("username")
return render(request, "accounts/manage_users.html", {"users": users})
@is_admin
def create_user(request):
form = CreateUserForm(request.POST or None)
if request.method == "POST" and form.is_valid():
user = form.save(commit=False)
user.set_password(form.cleaned_data["password"])
user.save()
messages.success(request, f"Account '{user.username}' created.")
return redirect("accounts:manage_users")
return render(request, "accounts/create_user.html", {"form": form})
View File
Whitespace-only changes.
+1
View File
@@ -0,0 +1 @@
# Register your models here.
+6
View File
@@ -0,0 +1,6 @@
from django.apps import AppConfig
class ArticlesConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "apps.articles"
Whitespace-only changes.
+1
View File
@@ -0,0 +1 @@
# Create your models here.
+1
View File
@@ -0,0 +1 @@
# Create your tests here.
+1
View File
@@ -0,0 +1 @@
# Create your views here.
View File
Whitespace-only changes.
+1
View File
@@ -0,0 +1 @@
# Register your models here.
+6
View File
@@ -0,0 +1,6 @@
from django.apps import AppConfig
class CoreConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "apps.core"
View File
Whitespace-only changes.
+1
View File
@@ -0,0 +1 @@
# Create your models here.
+1
View File
@@ -0,0 +1 @@
# Create your tests here.
+1
View File
@@ -0,0 +1 @@
# Create your views here.
View File
Whitespace-only changes.
+1
View File
@@ -0,0 +1 @@
# Register your models here.
+6
View File
@@ -0,0 +1,6 @@
from django.apps import AppConfig
class FeedsConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "apps.feeds"
View File
Whitespace-only changes.
+1
View File
@@ -0,0 +1 @@
# Create your models here.
+1
View File
@@ -0,0 +1 @@
# Create your tests here.
+1
View File
@@ -0,0 +1 @@
# Create your views here.
View File
Whitespace-only changes.
+1
View File
@@ -0,0 +1 @@
# Register your models here.
+6
View File
@@ -0,0 +1,6 @@
from django.apps import AppConfig
class PwaConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "apps.pwa"
View File
Whitespace-only changes.
+1
View File
@@ -0,0 +1 @@
# Create your models here.
+1
View File
@@ -0,0 +1 @@
# Create your tests here.
+1
View File
@@ -0,0 +1 @@
# Create your views here.
View File
Whitespace-only changes.
+1
View File
@@ -0,0 +1 @@
# Register your models here.
+6
View File
@@ -0,0 +1,6 @@
from django.apps import AppConfig
class ReaderConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "apps.reader"
View File
Whitespace-only changes.
+1
View File
@@ -0,0 +1 @@
# Create your models here.
+1
View File
@@ -0,0 +1 @@
# Create your tests here.
+9
View File
@@ -0,0 +1,9 @@
from django.urls import path
from . import views
app_name = "reader"
urlpatterns = [
path("", views.stream, name="stream"),
]
+7
View File
@@ -0,0 +1,7 @@
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
@login_required
def stream(request):
return render(request, "reader/stream.html")
View File
Whitespace-only changes.
+1
View File
@@ -0,0 +1 @@
# Register your models here.
+6
View File
@@ -0,0 +1,6 @@
from django.apps import AppConfig
class RulesConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "apps.rules"
View File
Whitespace-only changes.
+1
View File
@@ -0,0 +1 @@
# Create your models here.
+1
View File
@@ -0,0 +1 @@
# Create your tests here.
+1
View File
@@ -0,0 +1 @@
# Create your views here.
View File
Whitespace-only changes.
+1
View File
@@ -0,0 +1 @@
# Register your models here.
+6
View File
@@ -0,0 +1,6 @@
from django.apps import AppConfig
class SearchConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "apps.search"
View File
Whitespace-only changes.
+1
View File
@@ -0,0 +1 @@
# Create your models here.
+1
View File
@@ -0,0 +1 @@
# Create your tests here.
+1
View File
@@ -0,0 +1 @@
# Create your views here.
+3
View File
@@ -0,0 +1,3 @@
from .celery import app as celery_app
__all__ = ("celery_app",)
+16
View File
@@ -0,0 +1,16 @@
"""
ASGI config for config 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/5.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.prod")
application = get_asgi_application()
+20
View File
@@ -0,0 +1,20 @@
import os
from celery import Celery
from celery.schedules import crontab
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.dev")
app = Celery("evection")
app.config_from_object("django.conf:settings", namespace="CELERY")
app.autodiscover_tasks()
# A single fixed-interval beat schedule drives all feed polling; per-feed
# fetch_interval_minutes is plain model data evaluated inside poll_due_feeds,
# not a separate beat entry per feed.
app.conf.beat_schedule = {
"poll-due-feeds": {
"task": "apps.feeds.tasks.poll_due_feeds",
"schedule": crontab(minute="*/1"),
},
}
View File
Whitespace-only changes.
+113
View File
@@ -0,0 +1,113 @@
"""
Base Django settings for Evection, shared by all environments.
Environment-specific overrides live in dev.py / prod.py / test.py.
"""
from pathlib import Path
import environ
BASE_DIR = Path(__file__).resolve().parent.parent.parent
env = environ.Env()
env_file = BASE_DIR / ".env"
if env_file.exists():
environ.Env.read_env(str(env_file))
SECRET_KEY = env.str("SECRET_KEY", default="django-insecure-change-me-in-production")
DEBUG = env.bool("DEBUG", default=False)
ALLOWED_HOSTS = env.list("ALLOWED_HOSTS", default=["localhost", "127.0.0.1"])
INSTALLED_APPS = [
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
# third-party
"django_htmx",
# Evection apps
"apps.core",
"apps.accounts",
"apps.feeds",
"apps.articles",
"apps.rules",
"apps.search",
"apps.reader",
"apps.pwa",
]
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",
"django_htmx.middleware.HtmxMiddleware",
"apps.accounts.middleware.SetupWizardMiddleware",
]
ROOT_URLCONF = "config.urls"
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [BASE_DIR / "templates"],
"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 = "config.wsgi.application"
ASGI_APPLICATION = "config.asgi.application"
# Database — DATABASE_URL drives both SQLite and Postgres installs, e.g.:
# sqlite:///db.sqlite3
# postgres://user:pass@host:5432/dbname
DATABASES = {"default": env.db_url("DATABASE_URL", default=f"sqlite:///{BASE_DIR / 'db.sqlite3'}")}
AUTH_USER_MODEL = "accounts.User"
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"},
]
LOGIN_URL = "accounts:login"
LOGIN_REDIRECT_URL = "reader:stream"
LOGOUT_REDIRECT_URL = "accounts:login"
LANGUAGE_CODE = "en-us"
TIME_ZONE = "UTC"
USE_I18N = True
USE_TZ = True
STATIC_URL = "static/"
STATICFILES_DIRS = [BASE_DIR / "static"]
STATIC_ROOT = BASE_DIR / "staticfiles"
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
# Evection-specific settings
EVECTION_SIGNUP_ENABLED = env.bool("EVECTION_SIGNUP_ENABLED", default=False)
EVECTION_MIN_FETCH_INTERVAL_MINUTES = env.int("EVECTION_MIN_FETCH_INTERVAL_MINUTES", default=15)
EVECTION_PWA_CACHE_VERSION = env.str("EVECTION_PWA_CACHE_VERSION", default="v1")
# Celery
CELERY_BROKER_URL = env.str("REDIS_URL", default="redis://localhost:6379/0")
CELERY_RESULT_BACKEND = None
CELERY_TASK_SERIALIZER = "json"
CELERY_ACCEPT_CONTENT = ["json"]
CELERY_TIMEZONE = TIME_ZONE
+4
View File
@@ -0,0 +1,4 @@
from .base import * # noqa: F403
DEBUG = True
ALLOWED_HOSTS = ["*"]
+11
View File
@@ -0,0 +1,11 @@
from .base import * # noqa: F403
from .base import env
DEBUG = False
SECURE_SSL_REDIRECT = env.bool("SECURE_SSL_REDIRECT", default=True)
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
SECURE_HSTS_SECONDS = env.int("SECURE_HSTS_SECONDS", default=60 * 60 * 24 * 7)
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
+7
View File
@@ -0,0 +1,7 @@
from .base import * # noqa: F403
DEBUG = False
CELERY_TASK_ALWAYS_EAGER = True
CELERY_TASK_EAGER_PROPAGATES = True
PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"]
+8
View File
@@ -0,0 +1,8 @@
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path("admin/", admin.site.urls),
path("", include("apps.accounts.urls")),
path("", include("apps.reader.urls")),
]
+16
View File
@@ -0,0 +1,16 @@
"""
WSGI config for config 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/5.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.prod")
application = get_wsgi_application()
Executable
+23
View File
@@ -0,0 +1,23 @@
#!/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", "config.settings.dev")
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()
+56
View File
@@ -0,0 +1,56 @@
[build-system]
requires = ["setuptools>=68"]
build-backend = "setuptools.build_meta"
[project]
name = "evection"
version = "0.1.0"
description = "Self-hosted RSS/Atom feed reader, inspired by FreshRSS, built in Python/Django."
readme = "README.md"
requires-python = ">=3.11"
license = { text = "AGPL-3.0-or-later" }
dependencies = [
"django>=5.0,<5.3",
"celery>=5.3,<6",
"redis>=5,<6",
"feedparser>=6.0,<7",
"requests>=2.31,<3",
"nh3>=0.2,<1",
"defusedxml>=0.7,<1",
"django-environ>=0.11,<1",
"django-htmx>=1.17,<2",
"psycopg[binary]>=3.1,<4",
"gunicorn>=21,<24",
]
[project.optional-dependencies]
dev = [
"pytest>=8,<9",
"pytest-django>=4.8,<5",
"factory_boy>=3.3,<4",
"responses>=0.25,<1",
"freezegun>=1.4,<2",
"ruff>=0.4",
"black>=24",
]
[tool.setuptools]
py-modules = []
[tool.ruff]
line-length = 100
target-version = "py311"
exclude = [".venv", "migrations"]
[tool.ruff.lint]
select = ["E", "F", "I"]
[tool.black]
line-length = 100
target-version = ["py311", "py312"]
extend-exclude = "migrations"
[tool.pytest.ini_options]
DJANGO_SETTINGS_MODULE = "config.settings.test"
python_files = ["test_*.py", "*_test.py", "tests.py"]
testpaths = ["apps"]
+36
View File
@@ -0,0 +1,36 @@
:root {
color-scheme: light dark;
font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
body {
margin: 0;
padding: 1rem;
max-width: 48rem;
margin-inline: auto;
}
.messages {
list-style: none;
padding: 0;
}
.message {
padding: 0.5rem 0.75rem;
border-radius: 0.375rem;
margin-bottom: 0.5rem;
}
.message-success { background: #d1fae5; }
.message-error { background: #fee2e2; }
form p {
display: flex;
flex-direction: column;
gap: 0.25rem;
}
input, button {
font-size: 1rem;
padding: 0.5rem;
}
+10
View File
@@ -0,0 +1,10 @@
{% extends "base.html" %}
{% block title %}Create user — Evection{% endblock %}
{% block content %}
<h1>Create user</h1>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Create</button>
</form>
{% endblock %}
+10
View File
@@ -0,0 +1,10 @@
{% extends "base.html" %}
{% block title %}Log in — Evection{% endblock %}
{% block content %}
<h1>Log in</h1>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Log in</button>
</form>
{% endblock %}
+11
View File
@@ -0,0 +1,11 @@
{% extends "base.html" %}
{% block title %}Manage users — Evection{% endblock %}
{% block content %}
<h1>Users</h1>
<p><a href="{% url 'accounts:create_user' %}">Create user</a></p>
<ul>
{% for user in users %}
<li>{{ user.username }}{% if user.is_staff %} (admin){% endif %}{% if not user.is_active %} (disabled){% endif %}</li>
{% endfor %}
</ul>
{% endblock %}
+11
View File
@@ -0,0 +1,11 @@
{% extends "base.html" %}
{% block title %}Set up Evection{% endblock %}
{% block content %}
<h1>Welcome to Evection</h1>
<p>Create the first admin account for this instance.</p>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Create admin account</button>
</form>
{% endblock %}
+22
View File
@@ -0,0 +1,22 @@
{% load static %}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}Evection{% endblock %}</title>
<link rel="stylesheet" href="{% static 'css/base.css' %}">
</head>
<body>
{% if messages %}
<ul class="messages">
{% for message in messages %}
<li class="message message-{{ message.tags }}">{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
<main>
{% block content %}{% endblock %}
</main>
</body>
</html>
+7
View File
@@ -0,0 +1,7 @@
{% extends "base.html" %}
{% block title %}Stream — Evection{% endblock %}
{% block content %}
<h1>Your stream</h1>
<p>No feeds yet. The reading UI lands in a later milestone.</p>
<p><a href="{% url 'accounts:logout' %}">Log out</a></p>
{% endblock %}