---
# System prepended metadata

title: Issues hosting Django-React project

---

These are the files and parts of those files I modified:

1. `.envs/.production/.django`
2. `.envs/.production/.frontend`
3. `.envs/.production/.postgres`
4. `compose/production/traefik/traefik.yml`
5. `opencontractserver/contrib/sites/migrations/0003_set_site_domain_and_name.py`

Below I show the parts of the files that I modified:



1. `.envs/.production/.django`
```

DJANGO_SUPERUSER_PASSWORD=lcAr801aD@
DJANGO_SUPERUSER_EMAIL=fpichardom@yahoo.com
DJANGO_SUPERUSER_USERNAME=admin

# General
# ------------------------------------------------------------------------------
USE_DOCKER=yes
IPYTHONDIR=/app/.ipython
DJANGO_ALLOWED_HOSTS=django,127.0.0.1,localhost,0.0.0.0,biocollectiondocs.life
DJANGO_WORKER_TIMEOUT=3600

# AWS
# ------------------------------------------------------------------------------
# You can use local storage in the docker container, but this is not recommended for production
USE_AWS=True
DJANGO_AWS_ACCESS_KEY_ID=AKIAQ3EGQT3GSD6CM5VH
DJANGO_AWS_SECRET_ACCESS_KEY=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
DJANGO_AWS_STORAGE_BUCKET_NAME=biocollections-do
DJANGO_AWS_S3_REGION_NAME=us-west-1
```
2. `.envs/.production/.frontend`
```
REACT_APP_AUDIENCE=http://localhost:3000
REACT_APP_API_ROOT_URL=https://biocollectiondocs.life

# Uncomment to enable access to import functionality via the frontend
REACT_APP_ALLOW_IMPORTS=true
```

3. `.envs/.production/.postgres`

```
# PostgreSQL
# ------------------------------------------------------------------------------
POSTGRES_HOST=postgres
POSTGRES_PORT=25060
POSTGRES_DB=biocollection_documents
POSTGRES_USER=biocol
POSTGRES_PASSWORD=lcAr801aD@
```

4. `compose/production/traefik/traefik.yml`

    Changes regarding the domain name

```
certificatesResolvers:
  letsencrypt:
    # https://docs.traefik.io/master/https/acme/#lets-encrypt
    acme:
      email: "fpichardom@yahoo.com"
      storage: /etc/traefik/acme/acme.json
      # https://docs.traefik.io/master/https/acme/#httpchallenge
      httpChallenge:
        entryPoint: web
        
        
http:
  routers:

    flower-secure-router:
      rule: "Host(`biocollectiondocs.life`) || Host(`www.biocollectiondocs.life`) && PathPrefix(`/flower`)"
      entryPoints:
        - flower
      service: flower
      priority: 0
      tls:
        # https://docs.traefik.io/master/routing/routers/#certresolver
        certResolver: letsencrypt

    frontend-secure-router:
      rule: "(Host(`biocollectiondocs.life`) || Host(`www.biocollectiondocs.life`)) && !PathPrefix(`/graphql`) && !PathPrefix(`/admin`) && !PathPrefix(`/flower`)"
      entryPoints:
        - "web-secure"
      middlewares:
        - "csrf"
      service: frontend
      priority: 1
      tls:
        # https://docs.traefik.io/master/routing/routers/#certresolver
        certResolver: letsencrypt

    web-secure-router:
      rule: "(Host(`biocollectiondocs.life`) || Host(`www.biocollectiondocs.life`)) && (PathPrefix(`/graphql`) || PathPrefix(`/admin`))"
      entryPoints:
        - "web-secure"
      middlewares:
        - "csrf"
      service: django
      priority: 2
      tls:
        # https://docs.traefik.io/master/routing/routers/#certresolver
        certResolver: letsencrypt        
```



5. `opencontractserver/contrib/sites/migrations/0003_set_site_domain_and_name.py`

 Changed domain name
```

```def update_site_forward(apps, schema_editor):
    """Set site domain and name."""
    Site = apps.get_model("sites", "Site")
    Site.objects.update_or_create(
        id=settings.SITE_ID,
        defaults={
            "domain": "biocollectiondocs.life",
            "name": "BioCollectionDocs",
        },
    )
```
```
def update_site_backward(apps, schema_editor):
    """Revert site domain and name to default."""
    Site = apps.get_model("sites", "Site")
    Site.objects.update_or_create(
        id=settings.SITE_ID, defaults={"domain": "biocollectiondocs.life", "name": "BioCollectionDocs"}
    )
```