Skip to main content

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

  1. On the Railway canvas, right-click an empty area and select Add Service
  2. Select Bucket from the list
  3. Click Deploy to provision the bucket
  4. Navigate to the Credentials tab of the bucket
  5. Click Add to Service
  6. Select the service (your Django app) you want to connect the bucket to
  7. Under Style, select either:
    • AWS SDK (Generic) — for general S3-compatible access
    • Django (django-storages) — injects variables matching django-storages naming
  8. The injected environment variables will match what this package expects:
    • AWS_ACCESS_KEY_ID
    • AWS_SECRET_ACCESS_KEY
    • AWS_STORAGE_BUCKET_NAME
    • AWS_S3_ENDPOINT_URL
    • AWS_S3_REGION_NAME
  9. 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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_railway_storage-1.0.4.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_railway_storage-1.0.4-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file django_railway_storage-1.0.4.tar.gz.

File metadata

  • Download URL: django_railway_storage-1.0.4.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for django_railway_storage-1.0.4.tar.gz
Algorithm Hash digest
SHA256 6eb670833ac3b4cfaf077c643db29ffefdd43b7d3d5fbe6311b30ee976942db2
MD5 5d22f7c1635b9725cbee0ce65a78a49f
BLAKE2b-256 2dc524e877d60989d768b977b9494160972e88bc450afe496f4ccff274b170aa

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_railway_storage-1.0.4.tar.gz:

Publisher: ci.yml on Franklinson/Railway-Storage

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_railway_storage-1.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for django_railway_storage-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5f7b7ff82e69e6c1ae6fd45c87f7be14aa4759e6321fc16f837916cccb06de0f
MD5 60e1d53ec0bdbdf49a06d25f0845498c
BLAKE2b-256 88466beff1408a40291a2c2ce2d3f7dd044c33791d681d4e41b01c9a479b66bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_railway_storage-1.0.4-py3-none-any.whl:

Publisher: ci.yml on Franklinson/Railway-Storage

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page