diff --git a/Dockerfile b/Dockerfile index 26dd825..5974b9b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,8 +16,8 @@ RUN pip install --no-cache-dir -r requirements.txt COPY . . # run the Django migrations -RUN python manage.py makemigrations -RUN python manage.py migrate +# RUN python manage.py makemigrations +# RUN python manage.py migrate # run the Django server -ENTRYPOINT ["python", "manage.py", "runserver", "0.0.0.0:8000"] \ No newline at end of file +# ENTRYPOINT ["python", "manage.py", "runserver", "0.0.0.0:8000"] diff --git a/Procfile b/Procfile index 7ca6b10..b6c354e 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1,2 @@ +web: gunicorn mentorq_main.wsgi --log-file - release: python manage.py migrate -web: gunicorn mentorq_main.wsgi \ No newline at end of file diff --git a/mentorq_main/settings/common.py b/mentorq_main/settings/common.py index 9850580..a77630d 100644 --- a/mentorq_main/settings/common.py +++ b/mentorq_main/settings/common.py @@ -1,8 +1,13 @@ import os import pathlib +import environ + +# Use to get environment variables +env = environ.Env() # Build paths inside the project like this: os.path.join(BASE_DIR, ...) -BASE_DIR = str(pathlib.Path(__file__).absolute().parent.parent.parent) +# BASE_DIR = str(pathlib.Path(__file__).absolute().parent.parent.parent) +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Application definition @@ -53,10 +58,12 @@ # Database DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), - } + #'default': { + # 'ENGINE': 'django.db.backends.sqlite3', + # 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + #} + + 'default': env.db('DATABASE_URL'), } # custom authentication backend for Mentorq diff --git a/mentorq_main/settings/local.py b/mentorq_main/settings/local.py index 48a4a80..141fbfa 100644 --- a/mentorq_main/settings/local.py +++ b/mentorq_main/settings/local.py @@ -11,7 +11,8 @@ ALLOWED_HOSTS = ["*"] STATIC_URL = "/static/" +STATIC_ROOT = os.path.join(BASE_DIR, 'static') SIMPLE_JWT = { "ACCESS_TOKEN_LIFETIME": timedelta(days=1) -} \ No newline at end of file +} diff --git a/mentorq_main/settings/production.py b/mentorq_main/settings/production.py index be3c7cd..7495f77 100644 --- a/mentorq_main/settings/production.py +++ b/mentorq_main/settings/production.py @@ -1,6 +1,6 @@ from .common import * -import django_heroku +#import django_heroku DEBUG = False -django_heroku.settings(locals()) +#django_heroku.settings(locals()) diff --git a/mentorq_main/urls.py b/mentorq_main/urls.py index 7f8c641..ee82f8d 100644 --- a/mentorq_main/urls.py +++ b/mentorq_main/urls.py @@ -11,6 +11,6 @@ # if the environment var LCS_DEV is set, it will use the dev lcs endpoint # doesn't matter what the actual value is, it just has to be set -if os.getenv("LCS_DEV"): - set_testing(True) - print("Set testing mode successfully") +#if os.getenv("LCS_DEV"): +# set_testing(True) +# print("Set testing mode successfully") diff --git a/requirements.txt b/requirements.txt index 5fe11cf..7104a13 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,7 @@ certifi==2020.6.20 chardet==3.0.4 Django==3.0.14 django-cors-headers==3.4.0 +django-environ djangorestframework==3.11.2 djangorestframework-simplejwt==4.4.0 idna==2.10 @@ -16,4 +17,3 @@ six==1.15.0 sqlparse==0.3.1 urllib3==1.25.9 gunicorn==20.0.4 -django-heroku==0.3.1