diff --git a/docs/INSTALLATION.md b/docs/INSTALLATION.md index fa517093..3aa58f67 100644 --- a/docs/INSTALLATION.md +++ b/docs/INSTALLATION.md @@ -18,7 +18,11 @@ Plio backend uses Postgres SQL database. Use the instructions below to set up th ```sh psql ``` - - You should be inside the PostgreSQL shell + If you get an error saying `error: psql: error: FATAL: database "{USER_NAME}" does not exist`, run the following command before entering `psql`: + ```sh + createdb + ``` + - If everything works correctly, you should be inside the PostgreSQL shell 2. Windows @@ -78,7 +82,26 @@ Plio backend uses Postgres SQL database. Use the instructions below to set up th ```sh python manage.py migrate_schemas --shared ``` - - For seeding database and creating tenant organizations, visit the our [multitenancy](MULTITENANCY.md) guidelines. + - Create a public tenant in your database + - Get into python shell. + ```sh + python manage.py shell + ``` + - Run the following commands to a create public tenant. This will be used by the appplication to determine what data to load in the default URL. + ```py + # create your public tenant + from organizations.models import Organization, Domain + + tenant = Organization(schema_name='public', name='Plio', shortcode='plio') + tenant.save() + + domain = Domain() + domain.domain = 'plio.in' # use domain.domain = '0.0.0.0' for development environment + domain.tenant = tenant + domain.is_primary = True + domain.save() + ``` + - For more details on database seeding and creating tenant organizations, visit our [multitenancy](MULTITENANCY.md) guidelines. 8. For **DEVELOPMENT PURPOSE** only, run the following command to install pre-commit ```sh diff --git a/docs/MULTITENANCY.md b/docs/MULTITENANCY.md index 41d75f29..01c37fdc 100644 --- a/docs/MULTITENANCY.md +++ b/docs/MULTITENANCY.md @@ -12,6 +12,7 @@ Run the following commands to create an organization from programmatically: ``` 2. Create a public tenant that will be the default one. + ```py # create your public tenant from organizations.models import Organization, Domain @@ -20,7 +21,7 @@ Run the following commands to create an organization from programmatically: tenant.save() domain = Domain() - domain.domain = 'plio.in' + domain.domain = 'plio.in' # use domain.domain = '0.0.0.0' for development environment domain.tenant = tenant domain.is_primary = True domain.save() diff --git a/requirements.txt b/requirements.txt index e3c568e6..2e32808f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,7 +14,7 @@ idna==2.10 jmespath==0.10.0 numpy==1.20.1 pandas==1.2.2 -psycopg2==2.8.6 +psycopg2-binary==2.8.6 python-dateutil==2.8.1 pytz==2020.1 PyYAML==5.4.1