Skip to content

Grit One Quickstart

This document will get you up and running with Grit One.

Prerequisites

  • Python 3.13+
  • MacOS 15.6+ or Linux
  • A Grit account. This app is provisioned for your organization as part of a Grit enterprise engagement. Self-registration is not available; if you do not have an account, please contact your account manager or contact us to set one up.
  • Grit One SDK binaries that need to be installed on top of the git repo. These are provided by Grit once you have an account.

Getting Started

Installation

Before running the application, make sure to install the necessary dependencies. Follow these steps:

  1. Open a terminal or command prompt. Clone the project from Github:
    git clone https://github.com/gritholdings/grit-one-sdk-python
    
  2. Add the Grit One SDK binaries on top of the cloned repo by running the installation script provided with your Grit account. You will receive this script after you open a Grit account.
  3. Assuming that you have a supported version of Python installed, you can first set up your environment with:
    python3.13 -m venv env
    source env/bin/activate
    
    Note: If command not found: python3.13, use brew install python@3.13
  4. Install the backend dependencies using pip:
    pip install -r requirements.txt
    
    This command will install all the Python packages listed in the requirements.txt file.
  5. Perform necessary installation. This is to install Tailwind CSS.
    chmod +x ./scripts/install.sh
    ./scripts/install.sh
    
  6. For local development, add this in BASE_DIR/credentials.json:
    {
        "SECRET_KEY": "xxxx",
        "DATABASE_PASSWORD": ""
    }
    
  7. Go to aws.amazon.com -> RDS -> DB Instances -> database instance. Copy this endpoint. Update 'HOST' in DATABASES in settings.py to use this value.
    DATABASES = {
        'default': {
        ...
        'HOST': 'database-1-instance-1.xxxx.us-east-1.rds.amazonaws.com'
        }
    }
    
  8. Edit security group for the RDS.
    • In aws.amazon.com, RDS, click on database-1-instance-1 -> connectivity & security -> EC2 Security Group - inbound -> Edit inbound rules.
    • Remove the default rule, then add Type: PostgreSQL, Source: Anywhere-IPv4, then save rules.
    • Note that this is for development only. Change this setting in production.
  9. In aws.amazon.com, go to S3, then create (if it doesn't exist yet) a bucket for your chatbot vectorstores (assets).
    @dataclass
    class CustomConfig(Config):
       aws_s3_bucket_name: str = "yourdomain.example.com-assets"
    
  10. In IAM, create a new user (if it doesn't exist yet) to access the S3 bucket. Then, add in credentials.json:
    {
        ...
        "AWS_ACCESS_KEY_ID": "YOUR_AWS_ACCESS_KEY_ID",
        "AWS_SECRET_ACCESS_KEY": "YOUR_AWS_SECRET_ACCESS_KEY"
    }
    
  11. Run python manage.py migrate to apply database migrations for the first time.
  12. Create a new super admin. Run python manage.py createsuperuser, input email and password.

Run Local Development

  1. Activate environment
    source env/bin/activate
    
  2. Run server locally
    python manage.py runserver
    

Test Authentication

To test authentication run the following:

curl -X POST -d "username=your_username&password=your_password" http://localhost:8000/auth/login/ -c cookies.txt

Set Up Database

  1. Perform schema check
    python manage.py check
    
  2. Perform make migrations
    python manage.py makemigrations
    
  3. Apply migrations
    python manage.py migrate
    

Deployment To Production

See Deployment