Skip to content

Commit

Permalink
Merge pull request #75 from avantifellows/feature/documentation-updates
Browse files Browse the repository at this point in the history
Documentation updates on multitenancy
  • Loading branch information
rathorevaibhav authored Mar 31, 2021
2 parents b9b45ea + 52d26fa commit 7d263d5
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
27 changes: 25 additions & 2 deletions docs/INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion docs/MULTITENANCY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7d263d5

Please sign in to comment.