Skip to content

easydevmixin/django_ssh_storage

Repository files navigation

django_ssh_storage

image

image

image

Simple Django app allowing you to store static and media assets on a remote server using SSH.

Documentation

The full documentation is at https://django_ssh_storage.readthedocs.io.

Quickstart

Install django_ssh_storage:

pip install django_ssh_storage

Add it to your INSTALLED_APPS settings:

INSTALLED_APPS = (
    ...
    'ssh_storage.apps.SshStorageConfig',
)

Set up the SSH_STORAGE_LOCATION dictionary in settings:

SSH_STORAGE_LOCATION = {
    "HOSTNAME": "10.0.0.101",
    "USERNAME": "ausername",
    "BASEPATH": "/home/ausername/www-data",
    "PASSWORD": "MySuperSecret",
    "RSA_KEY": "/home/ausername/.ssh/id_rsa_key",
    "PORT": "22",
    "STATIC_PROXY_PROTOCOL": "https://",
    "STATIC_PROXY_HOSTNAME": "my.website.com",
    "PROXY_PORT": "443",
}

Set up media and static files location in settings:

# Static files (CSS, JavaScript, Images)
STATICFILES_LOCATION = 'static'
STATIC_URL = '/static/'
STATICFILES_STORAGE = 'ssh_storage.custom_storage.StaticStorage'

# Media files
MEDIAFILES_LOCATION = "media"
MEDIA_URL = '/media/'
DEFAULT_FILE_STORAGE = 'ssh_storage.custom_storage.MediaStorage'

Your Django app is ready to save/load files remotely.

Features

  • TODO

Running Tests

Does the code actually work?

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox

Credits

Tools used in rendering this package:

About

Simple Django app allowing you to store static and media assets on a remote server using SSH.

Resources

License

Stars

Watchers

Forks

Packages

No packages published