๐Ÿš—Deployment

Easily Self Host Your Application

Self Hosting

Hosting Options - Digital Ocean

You can use any cloud provider to host your application. In this guide, we'll show you how to deploy with DigitalOcean. If you use the provided link, you will get a free $200 credit for your account.

Hosting Options - Colohouse

Another option for hosting is Colohouse VPS Cloud Servers. Their plans start at just $6.99 per month for a basic VPS and services range from there.

If you'll need a higher-end server for a more serious application, a dedicated enterprise server from Colohouse is a great place to look.

Hosting Option - Interserver

Interserver use the code PENNYDEAL to get your first month for only $0.01!

Create a VM

After you sign in or make an account, create an Ubuntu 20 VM (Droplet) in the region closest to your users. If you're just starting, the Regular CPU option is fine.

Environment Setup

You should now have an IP address after creating an Ubuntu VM. SSH into your VM to get set up with requirements.

ssh root@<IP>
apt-get update
apt install python3-pip nodejs zip

Clone Your Code

You can now clone your repository and install the necessary requirements. As an example, we'll clone the PySaaS boilerplate and assume you've set up your environment variables on your VM.

git clone https://github.com/getpysaas/pysaas.git
cd pysaas
pip install -r requirements.txt

Set API URL

Match the api_url parameter in rxconfig.py to your IP address:

import reflex as rx

config = rx.Config(
    app_name="pysaas",
    api_url="http://<IP>:8000",
    db_url="sqlite:///reflex.db",
    env=rx.Env.DEV,
)

Run Your App

Run a test in development mode to make sure everything works as expected.

reflex init
reflex run --port 80

To run in production mode and create an optimized build of your app, run:

reflex run --env prod --port 80

You should now be able to see the app live by typing your IP address into your browser. Now, if you'd like, get a custom domain and point it to your IP address!

The links above can contain affiliate links to services. By using these links, it helps support PySaaS development even more and doesn't cost you a dime extra!

Last updated