Deploy

Here are the steps to deploy your application to Heroku, a popular cloud platform service that enables developers to build, run, and operate applications entirely in the cloud.

1. Create a Heroku app

This command creates a new application on Heroku, where my-app-name is the unique name for your app.

heroku apps:create my-app-name

2. Add environment variables

In Heroku's dashboard, under your app's settings, use 'Reveal config vars' to add your production environment variables. These are key-value pairs that your application will use in production.

3. Configure Redis

This command adds a Redis instance to your app, providing an in-memory data structure store, used as a database, cache, and message broker.

heroku addons:create heroku-redis -a my-app-name

4. Configure your Postgres database

Adds a PostgreSQL database to your Heroku application. Heroku Postgres is a managed SQL database service provided by Heroku.

heroku addons:create heroku-postgresql:basic -a my-app-name

5. Deploy the app

You have a few options for deployment: connect your GitHub repository to Heroku for automatic deploys upon push to your repo.

Alternatively, you can deploy your app manually using the following Heroku CLI command:

git push heroku master

6. Create an admin user

This command runs Django's createsuperuser management command on Heroku, allowing you to create an admin user to access the Django admin dashboard.

heroku run python manage.py createsuperuser -a my-app-name

7. Scale worker and celery beat dynos

These commands scale up your worker and Celery beat dynos to ensure that background tasks and periodic tasks are handled properly in your production environment.

heroku ps:scale worker=1 -a my-app-name
heroku ps:scale celery_beat=1 -a my-app-name

8. Add subscription plans or products via your admin dashboard:

Once your admin user is set up, log in to the Django admin to manually input subscription plans. This involves setting the price, selecting the payment provider (PayPal/Stripe), and providing the external plan ID which is recognized by your payment provider.

Configure subscriptions

Follow these instructions to configure your Stripe or Paypal subscriptions.

How To Configure Subscriptions