fixing sqlite
This commit is contained in:
1
.env
Normal file
1
.env
Normal file
@@ -0,0 +1 @@
|
|||||||
|
SECRET_KEY = "django-insecure-4u__7o5r4h=k@qn_wk-h5$u_+bwo&gzvz5oph#+cny(#2wt6+)"
|
||||||
@@ -2,7 +2,6 @@ FROM python:3.8.1-slim-buster
|
|||||||
|
|
||||||
ENV PYTHONUNBUFFERED=1
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
# Install system dependencies
|
|
||||||
RUN apt-get update --yes && apt-get install --yes --no-install-recommends \
|
RUN apt-get update --yes && apt-get install --yes --no-install-recommends \
|
||||||
build-essential \
|
build-essential \
|
||||||
libpq-dev \
|
libpq-dev \
|
||||||
@@ -12,22 +11,17 @@ RUN apt-get update --yes && apt-get install --yes --no-install-recommends \
|
|||||||
gettext \
|
gettext \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Add and set up the working directory
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy requirements file and install dependencies
|
|
||||||
COPY requirements.txt /app/
|
COPY requirements.txt /app/
|
||||||
RUN pip install --upgrade pip \
|
RUN pip install --upgrade pip \
|
||||||
&& pip install -r /app/requirements.txt
|
&& pip install -r /app/requirements.txt
|
||||||
|
|
||||||
# Copy application code
|
|
||||||
COPY . /app/
|
COPY . /app/
|
||||||
|
|
||||||
# Collect static files
|
|
||||||
RUN python manage.py collectstatic --noinput --clear
|
RUN python manage.py collectstatic --noinput --clear
|
||||||
|
RUN python manage.py migrate --noinput
|
||||||
|
|
||||||
# Expose the port the app runs on
|
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
# Run the application server
|
|
||||||
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "saburly.wsgi:application"]
|
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "saburly.wsgi:application"]
|
||||||
1
Procfile
Normal file
1
Procfile
Normal file
@@ -0,0 +1 @@
|
|||||||
|
web: gunicorn saburly.wsgi:application --bind 0.0.0.0:8000
|
||||||
Binary file not shown.
8
saburly/settings/getenv.py
Normal file
8
saburly/settings/getenv.py
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import os
|
||||||
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
|
|
||||||
|
def get_env_variable(var_name):
|
||||||
|
try:
|
||||||
|
return os.environ[var_name]
|
||||||
|
except KeyError:
|
||||||
|
raise ImproperlyConfigured(f"Set the {var_name} environment variable")
|
||||||
@@ -1,9 +1,12 @@
|
|||||||
from .base import *
|
from .base import *
|
||||||
|
from .getenv import get_env_variable
|
||||||
|
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
|
|
||||||
ALLOWED_HOSTS = ['18.196.202.28']
|
ALLOWED_HOSTS = ['18.196.202.28']
|
||||||
|
|
||||||
|
SECRET_KEY = get_env_variable('SECRET_KEY')
|
||||||
|
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
|
|||||||
Reference in New Issue
Block a user