Metadata-Version: 2.4
Name: django-project-core-settings
Version: 1.0.4
Summary: Secure, modular Django project foundation with environment-aware settings and optional session/API authentication.
Author: Wilfred Pine
License: MIT
Requires-Python: >=3.12
Description-Content-Type: text/markdown
Requires-Dist: Django<6.2,>=6.1.1
Requires-Dist: argon2-cffi<26,>=23.1
Requires-Dist: python-dotenv<2,>=1.2.3
Requires-Dist: whitenoise<7,>=6.12
Provides-Extra: api
Requires-Dist: djangorestframework<3.19,>=3.18; extra == "api"
Requires-Dist: djangorestframework-simplejwt<6,>=5.5.1; extra == "api"
Requires-Dist: PyJWT<3,>=2.15; extra == "api"
Provides-Extra: redis
Requires-Dist: django-redis<8,>=7; extra == "redis"
Provides-Extra: dev
Requires-Dist: build<2,>=1.2; extra == "dev"
Requires-Dist: pip<27,>=26.2; extra == "dev"
Requires-Dist: pip-audit<3,>=2.10; extra == "dev"
Requires-Dist: pytest<10,>=9.0.3; extra == "dev"
Requires-Dist: pytest-django<5,>=4.11; extra == "dev"
Requires-Dist: ruff<0.13,>=0.12; extra == "dev"
Requires-Dist: setuptools>=75; extra == "dev"
Requires-Dist: twine<8,>=6; extra == "dev"
Requires-Dist: urllib3<3,>=2.8; extra == "dev"
Requires-Dist: wheel>=0.45; extra == "dev"
Provides-Extra: full
Requires-Dist: djangorestframework<3.19,>=3.18; extra == "full"
Requires-Dist: djangorestframework-simplejwt<6,>=5.5.1; extra == "full"
Requires-Dist: PyJWT<3,>=2.15; extra == "full"
Requires-Dist: django-redis<8,>=7; extra == "full"

# django-project-core-settings

Secure, environment-aware Django project defaults with optional **form/session** and **API/JWT** authentication.

This package is a **Django project foundation**. Your project owns its user model, application structure, URLs, templates, deployment platform, and operational policies.

## Quick Start

```powershell
py -m venv .venv
.\.venv\Scripts\Activate.ps1
py -m pip install "django-project-core-settings"
django-admin startproject config .
```

Then configure your project according to the guided documentation.

## Guided Documentation

Detailed installation, configuration, authentication, architecture, security, and development guidance is maintained separately in `guided_docs/`.

### General setup

**[guided_docs/README.md](guided_docs/README.md)**
**[https://github.com/wilfredpine/django-project-core-settings/tree/main/guided_docs](https://github.com/wilfredpine/django-project-core-settings/tree/main/guided_docs)**

Use this first for the common Django project setup and package integration.

### API/JWT projects

**[guided_docs/README-API.md](guided_docs/README-API.md)**

Use this for projects using API/JWT authentication.

For framework-independent frontend/CORS configuration, session-cookie guidance,
trusted proxies, and optional scoped API keys, see
**[guided_docs/FRONTEND_AND_API_KEYS.md](guided_docs/FRONTEND_AND_API_KEYS.md)**.

The [wheel-installed consumer example](examples/wheel_consumer/README.md) builds a wheel, installs it in a clean environment outside this checkout, and exercises session, frontend, JWT, API-key, and security behavior.

```env
CORE_ENABLE_API=true
```

```python
path(
    "api/auth/",
    include("django_project_core_settings.auth.api_urls"),
)
```

### Session-based projects

**[guided_docs/README-SESSION.md](guided_docs/README-SESSION.md)**

Use this for projects using Django form/session authentication.

```python
path(
    "auth/",
    include("django_project_core_settings.auth.urls"),
)
```

## Which guide should I use?

```text
New Django project
       │
       ▼
guided_docs/README.md
       │
       ├── API/JWT ──────► guided_docs/README-API.md
       │
       └── Session ─────► guided_docs/README-SESSION.md
```

Additional files under `guided_docs/` contain the recommended application architecture, AI-agent workflow, security guidance, and development conventions.

## Package Options

Base package:

```bash
python -m pip install "django-project-core-settings"
```

API/JWT support:

```bash
python -m pip install "django-project-core-settings[api]"
```

API + CORS + Redis:

```bash
python -m pip install "django-project-core-settings[full]"
```

## Security Baseline

The package provides secure Django-oriented defaults for areas such as:

- password hashing;
- CSRF;
- secure production cookies;
- HTTPS/HSTS;
- CSP;
- upload limits;
- environment-based secrets;
- authentication rate limiting;
- API/JWT security.

These defaults are a foundation, not a production-readiness certification. Validate your application's configuration, infrastructure, secrets, TLS termination, backups, logging, and monitoring.

## User Model

The package does **not** provide a project user model.

Your project owns the user model. For email authentication, the user model must expose an `email` field.

If role-based authentication is required, configure the project's role field according to the guided documentation.

Arbitrary public role assignment is forbidden. Projects may explicitly enable
allow-listed self-selection for non-privileged model choices; see
`guided_docs/ROLE_REGISTRATION_AND_EMAIL.md`.

## Updating

Projects depend on the package rather than copied framework code:

```bash
python -m pip install --upgrade django-project-core-settings
```

## Verification

Run the appropriate Django checks and tests:

```bash
python manage.py check
python manage.py check --deploy
python manage.py test
```

For API projects, apply the required migrations before testing:

```bash
python manage.py migrate
```

## Examples

Runnable examples are available in:

```text
guided_docs/examples/
```

Use the corresponding guided documentation for the complete setup and implementation flow.

## License

MIT
