{% hint style="info" %}
Github https://github.com/rfschubert/masonite-digitalocean-driver
Pypi https://pypi.org/project/masonite-digitalocean-driver
{% endhint %}
In order to use the Dropbox upload driver, you'll need:
- Python 3.4+
- Pip3
- Masonite 2.0+
- boto3
{% code-tabs %} {% code-tabs-item title="terminal" %}
$ pip install masonite-digitalocean-driver
{% endcode-tabs-item %} {% endcode-tabs %}
Paste the access token in your project's .env
file along with the folder name where you want your uploads to be saved.
{% code-tabs %} {% code-tabs-item title=".env" %}
DO_REGION=nyc3
DO_ENDPOINT=https://nyc3.digitaloceanspaces.com
DO_SPACE=hello-space
DO_CLIENT=JIGJKDIKEL22VMKKIUYE
DO_SECRET=+zs11IroZZpoiGK4h+quKKsjXwP67ssOOAD2gawvNmX
{% endcode-tabs-item %} {% endcode-tabs %}
Add the DigitalOceanProvider to PROVIDERS in the config/providers.py
file.
{% code-tabs %} {% code-tabs-item title="config/providers.py" %}
from masonite.contrib.digitalocean.providers import DigitalOceanProvider
PROVIDERS = [
# Third Party Providers
DigitalOceanProvider,
]
{% endcode-tabs-item %} {% endcode-tabs %}
{% code-tabs %} {% code-tabs-item title="ActivityController.py" %}
class ActivityController:
def create(self, View):
return View('admin/activities/new')
def store(self, Upload, Request):
Upload.driver('digitalocean').store(Request.input('file_upload'))
return Request.redirect_to('dashboard')
{% endcode-tabs-item %} {% endcode-tabs %}