django-railway-storage
A Django package that provides Railway bucket storage backends and a management command to auto-configure your settings.
Installation
pip install django-railway-storage
Add to INSTALLED_APPS:
INSTALLED_APPS = [
...
'django_railway_storage',
]
Setting up a Railway Bucket
- On the Railway canvas, right-click an empty area and select Add Service
- Select Bucket from the list
- Click Deploy to provision the bucket
- Navigate to the Credentials tab of the bucket
- Click Add to Service
- Select the service (your Django app) you want to connect the bucket to
- Under Style, select either:
- AWS SDK (Generic) — for general S3-compatible access
- Django (django-storages) — injects variables matching
django-storagesnaming
- The injected environment variables will match what this package expects:
AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYAWS_STORAGE_BUCKET_NAMEAWS_S3_ENDPOINT_URLAWS_S3_REGION_NAME
- Click Add Service to save — the variables are now available in your Railway deployment
Usage
Auto-configure settings
Run the management command to append the storage config to your settings file:
# Private storage (presigned URLs, default)
python manage.py configure_railway_storage
# Public storage
python manage.py configure_railway_storage --storage public
# Custom settings file path
python manage.py configure_railway_storage --settings-file config/settings/production.py
# Custom presigned URL expiry (seconds)
python manage.py configure_railway_storage --storage private --expire 7200
Required environment variables
Railway injects these automatically when you connect a bucket to your service. Both naming styles are supported:
| Railway Variable | Alternative | Description |
|---|---|---|
AWS_ACCESS_KEY_ID |
— | Railway bucket access key |
AWS_SECRET_ACCESS_KEY |
— | Railway bucket secret key |
AWS_S3_BUCKET_NAME |
AWS_STORAGE_BUCKET_NAME |
Bucket name |
AWS_ENDPOINT_URL |
AWS_S3_ENDPOINT_URL |
Railway S3-compatible endpoint URL |
AWS_DEFAULT_REGION |
AWS_S3_REGION_NAME |
Region (default: us-east-1) |
Use backends directly
You can also reference the backends manually in your settings:
# Private (presigned URLs)
STORAGES = {
"default": {
"BACKEND": "django_railway_storage.backends.PrivateMediaStorage",
},
...
}
# Public
STORAGES = {
"default": {
"BACKEND": "django_railway_storage.backends.PublicMediaStorage",
},
...
}
Use on a model field
from django.db import models
class Document(models.Model):
file = models.FileField(upload_to='documents/') # uses default storage
Metadata
Release files for django-railway-storage 1.0.5
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 | Actions |
|---|---|---|---|---|
| django_railway_storage-1.0.5.tar.gz | 7.6 kB | With provenance | Details for django_railway_storage-1.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_railway_storage-1.0.5-py3-none-any.whl | Python 3 | none | any | Details for django_railway_storage-1.0.5-py3-none-any.whl |
Total release size: 15.1 kB
Release files / django_railway_storage-1.0.5.tar.gz
| Download URL | django_railway_storage-1.0.5.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
96a1ac0104f75b65827219ac7ad68824053efbf23219d6e7f3ea86905a0c1b81
|
|
BLAKE2b-256 checksum How to use checksums |
9a5e64f88b12ff32ae9520ae65d4f290b72957608a664cba13b6b5206236b4d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 14, 2026.
Transparency logRelease files / django_railway_storage-1.0.5-py3-none-any.whl
| Download URL | django_railway_storage-1.0.5-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
deee8165aa4ca3e3444c83f79b52d26db164c12493cad10adc72336d9eb36a44
|
|
BLAKE2b-256 checksum How to use checksums |
a59205eb35092955566ac229d9c1940dfdc94310d4aa95b7d3f2dbd1d5bc8cb0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 14, 2026.
Transparency logSecurity for django-railway-storage 1.0.5
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for django_railway_storage-1.0.5.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 14, 2026.
Transparency logA 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.