Initialize Fonrey Django multi-tenant project skeleton
Set up the required directory layout, app scaffolding, core settings, templates, static assets, and Docker/Tailwind tooling to establish a standardized development baseline.
This commit is contained in:
0
apps/tenant/__init__.py
Normal file
0
apps/tenant/__init__.py
Normal file
1
apps/tenant/admin.py
Normal file
1
apps/tenant/admin.py
Normal file
@@ -0,0 +1 @@
|
||||
from django.contrib import admin
|
||||
6
apps/tenant/apps.py
Normal file
6
apps/tenant/apps.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class TenantConfig(AppConfig):
|
||||
name = "apps.tenant"
|
||||
verbose_name = "租户管理"
|
||||
23
apps/tenant/models.py
Normal file
23
apps/tenant/models.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from django.db import models
|
||||
from django_tenants.models import DomainMixin, TenantMixin
|
||||
|
||||
|
||||
class Tenant(TenantMixin):
|
||||
name = models.CharField(max_length=100)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
auto_create_schema = True
|
||||
|
||||
class Meta:
|
||||
verbose_name = "租户"
|
||||
verbose_name_plural = "租户"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return self.name
|
||||
|
||||
|
||||
class Domain(DomainMixin):
|
||||
class Meta:
|
||||
verbose_name = "租户域名"
|
||||
verbose_name_plural = "租户域名"
|
||||
0
apps/tenant/services/.gitkeep
Normal file
0
apps/tenant/services/.gitkeep
Normal file
0
apps/tenant/services/__init__.py
Normal file
0
apps/tenant/services/__init__.py
Normal file
6
apps/tenant/tasks.py
Normal file
6
apps/tenant/tasks.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from celery import shared_task
|
||||
|
||||
|
||||
@shared_task
|
||||
def sample_task() -> str:
|
||||
return "tenant task placeholder"
|
||||
0
apps/tenant/tests/.gitkeep
Normal file
0
apps/tenant/tests/.gitkeep
Normal file
0
apps/tenant/tests/__init__.py
Normal file
0
apps/tenant/tests/__init__.py
Normal file
9
apps/tenant/urls.py
Normal file
9
apps/tenant/urls.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
|
||||
app_name = "tenant"
|
||||
|
||||
urlpatterns = [
|
||||
path("", views.index, name="index"),
|
||||
]
|
||||
5
apps/tenant/views.py
Normal file
5
apps/tenant/views.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
|
||||
|
||||
def index(request: HttpRequest) -> HttpResponse:
|
||||
return HttpResponse("tenant app placeholder")
|
||||
Reference in New Issue
Block a user