diff --git a/README.md b/README.md index 1b4cdad..1a98663 100644 --- a/README.md +++ b/README.md @@ -134,19 +134,25 @@ A summary of available commands are outlined below. Note that if the command req Create an interactive terminal into the postgres container ```bash -sudo docker-compose -f docker-compose.production.yaml up postgres +sudo docker-compose -f docker-compose.production.yaml up -d postgres sudo docker exec -it postgres bash ``` Within the interactive terminal. Connect to the database, add the righttree_admin user and give permissions. Please use the same credentials as defined in .env. ```bash psql -U postgres -/c righttree +\c righttree CREATE USER righttree_admin; ALTER USER righttree_admin with encrypted password 'YOUR PASSWORD'; GRANT ALL PRIVILEGES ON DATABASE righttree TO righttree_admin; ``` +Exit the container and stop postgres service: +``` +[CTRL-D] - to exit psql THEN [CTRL-D] to exit container +sudo docker-compose -f docker-compose.production.yaml down +``` + 6. Populate the database using `sudo ./dev populate_database` 7. Build optimised frontend build and collect together staticfiles `sudo ./dev create_staticfiles` 8. Create a django superuser for access to the admin interface. Please use the same credentials as defined in .env `sudo ./dev createsuperuser` diff --git a/backend/right_tree/settings.py b/backend/right_tree/settings.py index b7c0ace..1d9119b 100644 --- a/backend/right_tree/settings.py +++ b/backend/right_tree/settings.py @@ -139,8 +139,11 @@ STATIC_ROOT = os.path.join(PROJECT_DIR, 'staticfiles') DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' +frontend_url = os.getenv('FRONTEND_BASE_URL', 'localhost:3000') + CORS_ALLOWED_ORIGINS = [ - os.getenv("FRONTEND_BASE_URL") or 'http://localhost:3000' + f"https://{frontend_url}", + f"http://{frontend_url}" ] CORS_ALLOW_HEADERS = [ diff --git a/docker-compose.yaml b/docker-compose.yaml index 51c3931..907191d 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,8 +1,8 @@ version: "3.8" volumes: - local-postgres-data: - name: local-postgres-data + righttree-postgres-data: + name: righttree-postgres-data services: backend: @@ -35,7 +35,7 @@ services: restart: unless-stopped container_name: postgres volumes: - - local-postgres-data:/var/lib/postgresql/data + - righttree-postgres-data:/var/lib/postgresql/data - ./create_database.sql:/docker-entrypoint-initdb.d/create_database.sql ports: - "5432:5432"