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
Set these in your Railway project (or .env):
| Variable | Description |
|---|---|
AWS_ACCESS_KEY_ID |
Railway bucket access key |
AWS_SECRET_ACCESS_KEY |
Railway bucket secret key |
AWS_STORAGE_BUCKET_NAME |
Bucket name |
AWS_S3_ENDPOINT_URL |
Railway S3-compatible endpoint URL |
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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_railway_storage-1.0.3.tar.gz.
File metadata
- Download URL: django_railway_storage-1.0.3.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69778a803b43ed60e6b12026c51d4555fa836e05c5614d6aab49977c65444ff0
|
|
| MD5 |
41c5771d52c8b595935e8bacc0f1975b
|
|
| BLAKE2b-256 |
69e9c6203345b72631c1b8accaedd034aa3d0411874fbcc5c46126f61d94d7fb
|
Provenance
The following attestation bundles were made for django_railway_storage-1.0.3.tar.gz:
Publisher:
ci.yml on Franklinson/Railway-Storage
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_railway_storage-1.0.3.tar.gz -
Subject digest:
69778a803b43ed60e6b12026c51d4555fa836e05c5614d6aab49977c65444ff0 - Sigstore transparency entry: 2463574532
- Sigstore integration time:
-
Permalink:
Franklinson/Railway-Storage@bcc478977f55121e0dea0b58d4c566afc05bf53c -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/Franklinson
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@bcc478977f55121e0dea0b58d4c566afc05bf53c -
Trigger Event:
push
-
Statement type:
File details
Details for the file django_railway_storage-1.0.3-py3-none-any.whl.
File metadata
- Download URL: django_railway_storage-1.0.3-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53bad586e2f17f92879c67a5310cb36024e9c002020544c6541c24995e77ebcb
|
|
| MD5 |
7666822ea4c17301aaf86002bacf652c
|
|
| BLAKE2b-256 |
aab22c910976b06c3678320901db852aad230d8d2510f604ea4d0c1658228091
|
Provenance
The following attestation bundles were made for django_railway_storage-1.0.3-py3-none-any.whl:
Publisher:
ci.yml on Franklinson/Railway-Storage
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_railway_storage-1.0.3-py3-none-any.whl -
Subject digest:
53bad586e2f17f92879c67a5310cb36024e9c002020544c6541c24995e77ebcb - Sigstore transparency entry: 2463574654
- Sigstore integration time:
-
Permalink:
Franklinson/Railway-Storage@bcc478977f55121e0dea0b58d4c566afc05bf53c -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/Franklinson
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@bcc478977f55121e0dea0b58d4c566afc05bf53c -
Trigger Event:
push
-
Statement type: