DEV Community

Ayan Banerjee
Ayan Banerjee

Posted on • Edited on

2 2

MediDoc: Update 4 - Deployment

Deploying Django with the Digital Ocean Apps Platform was fairly straightforward. Overall, I followed this video with some minor changes to suit my needs:

Changes I made:

  1. If I let Django generate the secret key using get_random_secret_key() function, users have to login every time I made some code changes leading to a bad experience. Thus, I hardcode it in an environment variable.
  2. I also have another environment variable IS_POST (default to False) which is used to control the static file hosting.
  3. Since in MediDoc users can upload media, I also had to create DigitalOcean spaces and add the following configuration variables to my settings.py file.
if IS_PROD:
    DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
    AWS_S3_REGION_NAME = 'nyc3'
    AWS_S3_ENDPOINT_URL = f'https://{AWS_S3_REGION_NAME}.digitaloceanspaces.com'
    AWS_ACCESS_KEY_ID = os.getenv('AWS_ACCESS_KEY_ID')
    AWS_SECRET_ACCESS_KEY = os.getenv('AWS_SECRET_ACCESS_KEY')
    AWS_STORAGE_BUCKET_NAME = 'medidoc'
    AWS_S3_OBJECT_PARAMETERS = {
        'CacheControl': 'max-age=86400',
    }
    AWS_LOCATION = 'media'
Enter fullscreen mode Exit fullscreen mode

In the end, I have the following environment variables:
Alt Text

Check out the deployment here: https://medi-doc-njgqo.ondigitalocean.app/

Try It Out

To try it out, please create a patient account here and a medical account here (note that admin has to approve the medical accounts, so please wait a bit!).

Alternatively, you can use the following demo medical accounts:

  • devto-hospital
  • devto-diag
  • devto-pharmacy

And the patient account:

  • devto-patient

Password for all of them is: medidocpass@abc

Let me know what you think!

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more