summaryrefslogtreecommitdiffstats
path: root/takahe
diff options
context:
space:
mode:
authorAndrew Godwin2022-11-05 14:17:27 -0600
committerAndrew Godwin2022-11-05 14:17:27 -0600
commitd77dcf62b4005a0f36ef2fa7ba6d3651d2ef38d7 (patch)
treedd356a933b8179a22e5da6e938acd96a175ac0d6 /takahe
downloadtakahe-d77dcf62b4005a0f36ef2fa7ba6d3651d2ef38d7.tar.gz
takahe-d77dcf62b4005a0f36ef2fa7ba6d3651d2ef38d7.tar.bz2
takahe-d77dcf62b4005a0f36ef2fa7ba6d3651d2ef38d7.zip
Initial commit (users and statuses)
Diffstat (limited to 'takahe')
-rw-r--r--takahe/__init__.py0
-rw-r--r--takahe/asgi.py16
-rw-r--r--takahe/settings.py115
-rw-r--r--takahe/urls.py22
-rw-r--r--takahe/wsgi.py16
5 files changed, 169 insertions, 0 deletions
diff --git a/takahe/__init__.py b/takahe/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/takahe/__init__.py
diff --git a/takahe/asgi.py b/takahe/asgi.py
new file mode 100644
index 0000000..99a9cfb
--- /dev/null
+++ b/takahe/asgi.py
@@ -0,0 +1,16 @@
+"""
+ASGI config for takahe 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.1/howto/deployment/asgi/
+"""
+
+import os
+
+from django.core.asgi import get_asgi_application
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "takahe.settings")
+
+application = get_asgi_application()
diff --git a/takahe/settings.py b/takahe/settings.py
new file mode 100644
index 0000000..3e2b75a
--- /dev/null
+++ b/takahe/settings.py
@@ -0,0 +1,115 @@
+from pathlib import Path
+
+# Build paths inside the project like this: BASE_DIR / 'subdir'.
+BASE_DIR = Path(__file__).resolve().parent.parent
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = "insecure_secret"
+
+# 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",
+ "crispy_forms",
+ "core",
+ "statuses",
+ "users",
+]
+
+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 = "takahe.urls"
+
+TEMPLATES = [
+ {
+ "BACKEND": "django.template.backends.django.DjangoTemplates",
+ "DIRS": [BASE_DIR / "templates"],
+ "APP_DIRS": True,
+ "OPTIONS": {
+ "context_processors": [
+ "django.template.context_processors.debug",
+ "django.template.context_processors.request",
+ "django.contrib.auth.context_processors.auth",
+ "django.contrib.messages.context_processors.messages",
+ "core.context.config_context",
+ ],
+ },
+ },
+]
+
+WSGI_APPLICATION = "takahe.wsgi.application"
+
+DATABASES = {
+ "default": {
+ "ENGINE": "django.db.backends.sqlite3",
+ "NAME": BASE_DIR / "db.sqlite3",
+ }
+}
+
+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",
+ },
+]
+
+LANGUAGE_CODE = "en-us"
+
+TIME_ZONE = "UTC"
+
+USE_I18N = True
+
+USE_TZ = True
+
+STATIC_URL = "static/"
+
+DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
+
+AUTH_USER_MODEL = "users.User"
+
+LOGIN_URL = "/auth/login/"
+LOGOUT_URL = "/auth/logout/"
+LOGIN_REDIRECT_URL = "/"
+LOGOUT_REDIRECT_URL = "/"
+
+STATICFILES_FINDERS = [
+ "django.contrib.staticfiles.finders.FileSystemFinder",
+ "django.contrib.staticfiles.finders.AppDirectoriesFinder",
+]
+
+STATICFILES_DIRS = [
+ BASE_DIR / "static",
+]
+
+CRISPY_FAIL_SILENTLY = not DEBUG
+
+SITE_NAME = "takahē"
+DEFAULT_DOMAIN = "feditest.aeracode.org"
+ALLOWED_DOMAINS = ["feditest.aeracode.org"]
diff --git a/takahe/urls.py b/takahe/urls.py
new file mode 100644
index 0000000..422a182
--- /dev/null
+++ b/takahe/urls.py
@@ -0,0 +1,22 @@
+from django.contrib import admin
+from django.urls import path
+
+from core import views as core
+from users.views import auth, identity
+
+urlpatterns = [
+ path("", core.homepage),
+ # Authentication
+ path("auth/login/", auth.Login.as_view()),
+ path("auth/logout/", auth.Logout.as_view()),
+ # Identity views
+ path("@<handle>/", identity.ViewIdentity.as_view()),
+ path("@<handle>/actor/", identity.Actor.as_view()),
+ # Identity selection
+ path("identity/select/", identity.SelectIdentity.as_view()),
+ path("identity/create/", identity.CreateIdentity.as_view()),
+ # Well-known endpoints
+ path(".well-known/webfinger/", identity.Webfinger.as_view()),
+ # Django admin
+ path("djadmin/", admin.site.urls),
+]
diff --git a/takahe/wsgi.py b/takahe/wsgi.py
new file mode 100644
index 0000000..05ae06f
--- /dev/null
+++ b/takahe/wsgi.py
@@ -0,0 +1,16 @@
+"""
+WSGI config for takahe 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/4.1/howto/deployment/wsgi/
+"""
+
+import os
+
+from django.core.wsgi import get_wsgi_application
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "takahe.settings")
+
+application = get_wsgi_application()