๐ง Installation
Let's get the ball rolling
Prerequisites
To get started with PySaaS, you'll need to install the following system requirements if you don't already have them:
Python 3.9+
This looks different for each OS you could be installing to. The following installation will be on Ubuntu 20.
Clone the Boilerplate
After you purchase PySaaS, we'll invite you as a collaborator with read permissions to the private GitHub repository. From there, you can clone the codebase and start building your application.
Virtual Environment
We recommend creating a virtual environment for development. If you don't know how to create one, you can do it using Python's venv module.
Install Requirements
A requirements.txt file is included in the root directory of the repository. To install requirements required to run the template applications, run:
There also exists a requirements_dev.txt
file, but that is only needed if you are running the tests (in the works). Running the tests is recommended, but not necessary.
Project Structure
The boilerplate code structure is as follows.
assets
The assets directory contains static assets you can use in your application. The boilerplate codebase includes SVG and PNG images in the assets directory, but you can include any images, fonts, or other files.
pysaas
This is your main project directory. Your app's logic will be written here.
pysaas.py
contains the App, State classes and variables, and page details.
The pages
directory includes files for the separate pages of your application.
The components
directory contains components used within pages.
The auth
directory contains the code for the different authentication and database connections. You should not have to edit this code on your own unless you are adding a new authentication method yourself.
rxconfig.py
This file contains the configuration details for your application. Here, you can set your app name, environments, ports, database, and API URL.
tests
This directory contains the actual test files. You can add tests for your own application here. There will be tests already populated that cover the PySaaS deployment itself.
pytest.ini and .flake8
These are configuration files for the linter and testing. These files will be updated as the linting and testing are refined and developed further. You can edit these to tune them to your specific application.
Reflex
We highly recommend taking about 30 minutes to read more about Reflex and become familiar with the framework. PySaaS builds on the Reflex web framework to enable full-stack web development and deployment in pure Python.
Read the documentation here.
Environment Variables
When you clone the repository, you'll see a file named .env.example
in the root directory with the following content:
Your app will need these variables configured to connect to different sources during runtime.
There are currently two authentication/database options, Firebase
and Supabase
. You will not use both of these simultaneously, so you will need to choose your preferred option.
For now, let's copy the .env.example
to .env
and we will get the information needed throughout the rest of the installation.
For Ubuntu, here is the command to do this:
Important!
Depending on the authentication package you want to use, there will be different instructions. If you are using Firebase
, proceed to the next page and skip the Supabase
section afterwards. If you are using Supabase
, skip the Firebase
section and proceed to the Supabase
section.
Last updated