FastJango
FastJango is a fast web framework inspired by Django built on FastAPI. It provides a familiar Django-like experience with the performance and modern features of FastAPI. FastJango prefers convention over configuration and simplifies development of API First Web Services.
Features
- Django-like project structure
- FastAPI's high performance
- Type annotations and automatic validation
- Dependency injection
- Automatic API documentation with Swagger and ReDoc
- Familiar Django-like URL patterns
- FastAPI-powered REST API with automatic OpenAPI docs
- Integrated authentication system
- Django-like template system with Jinja2
- ORM support via SQLAlchemy (planned)
pip install typer rich fastapi uvicorn jinja2 python-multipart pydantic
Installation
pip install fastjango
For development:
git clone https://github.com/yourusername/fastjango.git
cd fastjango
pip install -e ".[dev]"
Quick Start
Create a new project
fastjango-admin startproject myproject
cd myproject
Create a new app
fastjango-admin startapp myapp
Don't forget to add your app to INSTALLED_APPS in settings.py:
INSTALLED_APPS = [
# FastJango apps
"myproject.core",
# Your apps
"myapp",
]
Define models in myapp/models.py
from fastjango.db import models
from fastjango.core.exceptions import ValidationError
class Item(models.Model):
name = models.CharField(max_length=100)
description = models.TextField(blank=True, null=True)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
class Meta:
ordering = ["-created_at"]
def __str__(self):
return self.name
Define routes in myapp/routes.py
from fastapi import APIRouter, HTTPException, Depends, status
from typing import List
from fastjango.core.dependencies import get_current_user
from .schemas import ItemCreate, ItemRead, ItemUpdate
from .services import ItemService
router = APIRouter(prefix="/items", tags=["items"])
service = ItemService()
@router.get("/", response_model=List[ItemRead])
async def list_items(skip: int = 0, limit: int = 100):
return await service.get_all(skip=skip, limit=limit)
@router.post("/", response_model=ItemRead, status_code=status.HTTP_201_CREATED)
async def create_item(item: ItemCreate, current_user = Depends(get_current_user)):
return await service.create(item)
Run the development server
fastjango-admin runserver
Or using the manage.py script:
python manage.py runserver
Visit http://127.0.0.1:8000/docs to see the automatic API documentation.
Project Structure
When you create a new project, FastJango will generate the following structure:
myproject/
├── myproject/
│ ├── __init__.py
│ ├── asgi.py
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
├── templates/
└── manage.py
When you create a new app, FastJango will generate:
myapp/
├── __init__.py
├── models.py
├── routes.py
├── schemas.py
├── services.py
└── tests/
├── __init__.py
├── test_models.py
└── test_routes.py
Built With
- FastAPI - Web framework
- Pydantic - Data validation
- Typer - CLI commands
- SQLAlchemy - ORM (planned)
License
This project is licensed under the MIT License - see the LICENSE file for details.
Make sure to reinstall after changes
pip install -e .
Then start your project
./fastjango-admin.py startproject myproject cd myproject ./fastjango-admin.py runserver
Metadata
Release files for fastjango 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| fastjango-0.1.1.tar.gz | 28.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fastjango-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 45.7 kB
Release files / fastjango-0.1.1.tar.gz
| Download URL | fastjango-0.1.1.tar.gz |
|---|---|
| Size | 28.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9897163ad8b3ce71e6f9bb0d5d843c58749e4bf4c1c96558db841f97e4e3f281
|
|
BLAKE2b-256 checksum How to use checksums |
e19f9349686ebd2b79002086a2d0d875122b4bf5b1d8bfecb033ee903685e5b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.14
|
Release files / fastjango-0.1.1-py3-none-any.whl
| Download URL | fastjango-0.1.1-py3-none-any.whl |
|---|---|
| Size | 17.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c30e86954f4f631b0da466fc02e73e1eb6b6c0d3fcc61dba630350e54dcf12a7
|
|
BLAKE2b-256 checksum How to use checksums |
1a52e500197aae0afba6505a3ab7ee637d9b31ab673d04f98eee8547ded6795e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.14
|
Security for fastjango 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.