feat: Django project skeleton with pytest setup
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
0
src/config/__init__.py
Normal file
0
src/config/__init__.py
Normal file
1
src/config/settings/__init__.py
Normal file
1
src/config/settings/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from .base import * # noqa: F401,F403
|
||||
58
src/config/settings/base.py
Normal file
58
src/config/settings/base.py
Normal file
@@ -0,0 +1,58 @@
|
||||
import os
|
||||
|
||||
SECRET_KEY = os.environ.get("DJANGO_SECRET_KEY", "dev-secret-key")
|
||||
DEBUG = False
|
||||
ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS", "*").split(",")
|
||||
|
||||
INSTALLED_APPS = [
|
||||
"django.contrib.admin",
|
||||
"django.contrib.auth",
|
||||
"django.contrib.contenttypes",
|
||||
"django.contrib.sessions",
|
||||
"django.contrib.messages",
|
||||
"django.contrib.staticfiles",
|
||||
"rest_framework",
|
||||
"openclaw",
|
||||
]
|
||||
|
||||
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 = "config.urls"
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
||||
"DIRS": [],
|
||||
"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",
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.postgresql",
|
||||
"HOST": os.environ.get("DB_HOST", "localhost"),
|
||||
"PORT": os.environ.get("DB_PORT", "5432"),
|
||||
"NAME": os.environ.get("DB_NAME", "openclaw_archive"),
|
||||
"USER": os.environ.get("DB_USER", "openclaw"),
|
||||
"PASSWORD": os.environ.get("DB_PASSWORD", ""),
|
||||
}
|
||||
}
|
||||
|
||||
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
||||
STATIC_URL = "static/"
|
||||
13
src/config/settings/dev.py
Normal file
13
src/config/settings/dev.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from pathlib import Path
|
||||
|
||||
BASE_DIR = Path(__file__).resolve(strict=True).parent.parent.parent.parent
|
||||
|
||||
from .base import * # noqa: F401,F403
|
||||
|
||||
DEBUG = True
|
||||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.sqlite3",
|
||||
"NAME": BASE_DIR / "db.sqlite3", # noqa: F821
|
||||
}
|
||||
}
|
||||
7
src/config/urls.py
Normal file
7
src/config/urls.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from django.contrib import admin
|
||||
from django.urls import path, include
|
||||
|
||||
urlpatterns = [
|
||||
path("admin/", admin.site.urls),
|
||||
path("api/", include("openclaw.urls")),
|
||||
]
|
||||
5
src/config/wsgi.py
Normal file
5
src/config/wsgi.py
Normal file
@@ -0,0 +1,5 @@
|
||||
import os
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
|
||||
application = get_wsgi_application()
|
||||
0
src/openclaw/__init__.py
Normal file
0
src/openclaw/__init__.py
Normal file
6
src/openclaw/apps.py
Normal file
6
src/openclaw/apps.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class OpenclawConfig(AppConfig):
|
||||
default_auto_field = "django.db.models.BigAutoField"
|
||||
name = "openclaw"
|
||||
3
src/openclaw/urls.py
Normal file
3
src/openclaw/urls.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.urls import path
|
||||
|
||||
urlpatterns = []
|
||||
Reference in New Issue
Block a user