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.
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
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.
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
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
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
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
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
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.
Follow these instructions to configure your Stripe or Paypal subscriptions.
How To Configure Subscriptions