Raystack is a modern, lightweight Python web framework that merges the asynchronous power of Starlette with the battle-tested structure and development convenience inspired by Django. A clean, minimal framework that gives you the best of both worlds!
Get your project up and running in minutes!
pip install raystackraystack startproject myproject
cd myprojectraystack runserverOpen your browser and navigate to: http://127.0.0.1:8000
Raystack introduces a unique approach to database interaction, allowing you to explicitly control whether to use synchronous or asynchronous operations by simply specifying the appropriate driver in your database URL.
The mode is determined by the presence of async drivers in your database URL within your config/settings.py file.
# Synchronous mode (default)
DATABASES = {
'default': {
'ENGINE': 'raystack.core.database.sqlalchemy',
'URL': 'sqlite:///db.sqlite3', # Sync mode
}
}
# Asynchronous mode
DATABASES = {
'default': {
'ENGINE': 'raystack.core.database.sqlalchemy',
'URL': 'sqlite+aiosqlite:///' + str(BASE_DIR / 'db.sqlite3'), # Async mode
}
}Synchronous:
- SQLite:
sqlite:///db.sqlite3 - PostgreSQL:
postgresql://user:pass@localhost/dbname - MySQL:
mysql://user:pass@localhost/dbname
Asynchronous:
- SQLite:
sqlite+aiosqlite:///db.sqlite3(requiresaiosqlite) - PostgreSQL:
postgresql+asyncpg://user:pass@localhost/dbname(requiresasyncpg) - MySQL:
mysql+aiomysql://user:pass@localhost/dbname(requiresaiomysql)
Raystack's ORM automatically detects the mode based on your database configuration and adapts accordingly. No need for separate sync/async methods!
# Create
article = await Article.objects.create(title="Hello", content="World", author_id=1)
# Get a single object
user = await UserModel.objects.get(id=1)
# Filter
users = await UserModel.objects.filter(age__gte=25).execute()
# Update
user.name = "Jane Doe"
await user.save()
# Delete
await user.delete()
# Count
count = await UserModel.objects.count()
# Check existence
exists = await UserModel.objects.filter(email="[email protected]").exists()Raystack core framework is minimal and doesn't include an admin panel by default. However, we provide a complete example project with admin interface and authentication:
π raystack-admin - A full-featured example project with:
- Administrative interface
- User authentication and authorization
- User and group management
- Session and JWT authentication
- Ready-to-use templates and static files
You can use raystack-admin as a reference implementation or starting point for your own admin interface.
- Technical Documentation
- ORM Reference
- Template Reference
- Command Reference
- Middleware Reference
- Extending Raystack
- FAQ
- raystack-admin - Example project with admin interface and authentication
Pull requests and issues are welcome! See GitHub.
MIT License. See LICENSE for details.