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!

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up