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

Getting Started

Install dependencies

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. 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
  3. 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.
  4. Perform necessary installation. This is to install Tailwind CSS.
    chmod +x ./scripts/install.sh
    ./scripts/install.sh
    
  5. For local development, add this in BASE_DIR/credentials.json:
    {
        "SECRET_KEY": "xxxx",
        "DATABASE_PASSWORD": ""
    }
    
  6. 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'
        }
    }
    
  7. 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.
  8. 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"
    
  9. 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"
    }
    
  10. Run python manage.py migrate to apply database migrations for the first time.
  11. 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