Development

Development Without Docker


Although not recommended, you can also working with your project directly on your host operating system.

This may be great for speed, but you may face problems later if your dev and production environments differ and your application behaves unpredictably.

Additionally, the project relies on other tools such as redis for async tasks/websockets and uses postgres as a database. You will have to setup Postgres and Redis manually.

Set up

Create a virtual environment

We suggest using a virtual environment if you developing directly on your OS.

Example for Mac OS.

python3 -m venv .venv
source .venv/bin/activate

Install package requirements

cd 'your project'
pip install -r requirements.txt

Set up redis

Caching and the task worker is setup to use redis.

  • Installation on mac

    $ brew update
    brew install redis
    
  • Other OS - Visit redis.io to download and setup a local instance of redis.

  • Online redis instance - create an online instance redis.io [freee forver]

Set up database (Postgres only)

Visit the postgresql to download and install postgres.

If you have installed with Postgres, edit the DATABASES value in config/base.py/settings.py with the appropriate details.

You will also need to create a database for your project if you haven’t already:

$ sudo -u postgres createdb {{ project_name }}

Running the app

Create database migrations

$ python ./manage.py makemigrations

Run database migrations

# python ./manage.py migrate

Run server

$ python ./manage.py runserver

Run tailwind cli tool

In another terminal, run the cli tool to compile your css and watch for changes

$ npm install
$ npm run watch

Go to http://localhost:8000 and you should see the default landing page!

Creating your first user

The Vanty Starter Kit Sign up flow works out of the box. By default you can already register and log in a user.

However for development, it is necessary to create a superuser that will be able to access the Django admin and Control Panel .

We added a modified createsuperuser command that will also create a tenant for the new superuser.

# the shortcut      
$ make verified_superuser

The command above will prompt you to add a password and will automatically create a superuser that using the email that you specified when building the project. To use another email run the command manually like below.

$ python manage.py create_verified_superuser email@example.com

Tips and Tricks

For convenience you can use honcho to run multiple processes using a single command. Honcho is a tool for running procfile based applications.

Install honcho

$ pip install honcho

Create a procfile

Procfile

release: python manage.py migrate
web: gunicorn config.wsgi:application
worker: python manage.py run_huey -w3
frontend: npm run watch

Run the app

$ honcho start