Skip to content

Commit

Permalink
Merge pull request #27 from HE-Arc/add-env-var
Browse files Browse the repository at this point in the history
Add env var
  • Loading branch information
maelys-buhler authored Mar 16, 2024
2 parents 7573221 + cdc0ac1 commit 583b427
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/django_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ jobs:
python -m pip install --upgrade pip
cd api
pip install -r requirements.txt
- name: Copy .env
run: |
cd api
cp .env.cicd .env
- name: Run Tests
run: |
cd api
Expand Down
6 changes: 6 additions & 0 deletions api/.env.cicd
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FRONTEND_URL=http://localhost:5173
BACKEND_URL=http://127.0.0.1:5173
DEBUG=True
SECRET_KEY=django-insecure-^=xy+akjdagtjisch+_5fku9!1aw)hhf_&feny8r3@6ds%rds
INIT_DATA_FOLDER=./data/csv/
IMAGES_FOLDER=./data/images/
1 change: 1 addition & 0 deletions api/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ django = "==5.0.2"
djangorestframework = "==3.14.0"
pandas = "*"
django-cors-headers = "*"
python-dotenv = "*"

[dev-packages]

Expand Down
11 changes: 10 additions & 1 deletion api/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 9 additions & 6 deletions api/masteriq/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

from pathlib import Path
import os
from dotenv import load_dotenv

load_dotenv()

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
Expand All @@ -21,16 +24,16 @@
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-^=xy+akjf7r600zo6r+_5fku9!1aw)hhf_&feny8r3@6ds%rds'
SECRET_KEY = os.getenv('SECRET_KEY')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG = os.getenv('DEBUG')

ALLOWED_HOSTS = []

CORS_ALLOWED_ORIGINS = [
"http://localhost:5173",
"http://127.0.0.1:5173",
os.getenv('FRONTEND_URL'),
os.getenv('BACKEND_URL'),
]

# Application definition
Expand Down Expand Up @@ -132,8 +135,8 @@
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'


INIT_DATA_FOLDER = os.path.join('data', 'csv')
IMAGES_FOLDER = os.path.join('data', 'images')
INIT_DATA_FOLDER = os.getenv("INIT_DATA_FOLDER") #os.path.join('data', 'csv')
IMAGES_FOLDER = os.getenv("IMAGES_FOLDER") #os.path.join('data', 'images')
DEFAULT_IMAGE = "default.jpeg"


Expand Down
Binary file modified api/requirements.txt
Binary file not shown.

0 comments on commit 583b427

Please sign in to comment.