diff --git a/.gitignore b/.gitignore index 238e0ab..4eb9f7b 100644 --- a/.gitignore +++ b/.gitignore @@ -64,6 +64,10 @@ db.sqlite3-journal instance/ .webassets-cache +# docker stuff: +data/ +docker.env + # Scrapy stuff: .scrapy @@ -139,3 +143,4 @@ dmypy.json /CDC_Backend/Storage/ .idea *.pyc + diff --git a/CDC_Backend/CDC_Backend/settings.py b/CDC_Backend/CDC_Backend/settings.py index 4c24f27..46727c5 100644 --- a/CDC_Backend/CDC_Backend/settings.py +++ b/CDC_Backend/CDC_Backend/settings.py @@ -29,7 +29,7 @@ SECRET_KEY = 'e_i2g3z!y4+p3dwm%k9k=zmsot@aya-0$mmetgxz4mp#8_oy#*' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -ALLOWED_HOSTS = ['cdc-iitdh.herokuapp.com/', 'localhost', '192.168.29.199'] +ALLOWED_HOSTS = ['cdc-iitdh.herokuapp.com/', 'localhost', '192.168.29.199', '127.0.0.1'] # Application definition diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7190339 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3 +ENV PYTHONDONTWRITEBYTECODE=1 +ENV PYTHONUNBUFFERED=1 +WORKDIR /code +COPY requirements.txt /code/ +RUN pip install -r requirements.txt +COPY . /code/ \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..8758a30 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,22 @@ +version: "3.9" + +services: + db: + image: postgres + volumes: + - ./data/db:/var/lib/postgresql/data + environment: + - POSTGRES_DB=postgres + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres + web: + build: . + command: python3 manage.py runserver 0.0.0.0:8000 + volumes: + - .:/code + working_dir: /code/CDC_backend + ports: + - "8000:8000" + env_file: docker.env + depends_on: + - db \ No newline at end of file diff --git a/example.docker.env b/example.docker.env new file mode 100644 index 0000000..bddb0e6 --- /dev/null +++ b/example.docker.env @@ -0,0 +1,11 @@ +DEBUG=True +EMAIL= +EMAIL_PASSWORD= +SECRET_KEY= +EMAIL_VERIFICATION_SECRET_KEY= +DB_NAME= +DB_USER= +DB_PASSWORD= +DB_HOST=db +DB_PORT=5432 +RECAPTCHA_SECRET_KEY=