Skip to content

Commit

Permalink
yupdate
Browse files Browse the repository at this point in the history
  • Loading branch information
determinedguy committed Jan 10, 2024
2 parents a48c0d5 + 69c3b65 commit c8f8045
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 11 deletions.
34 changes: 34 additions & 0 deletions Docker.file.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM python:3.10-slim-buster

WORKDIR /app

ENV PYTHONUNBUFFERED=1 \
PYTHONPATH=/app \
DJANGO_SETTINGS_MODULE=reflekt_io.settings \
PORT=8000 \
WEB_CONCURRENCY=2

# Install system packages required Django.
RUN apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*

RUN addgroup --system django \
&& adduser --system --ingroup django django

# Requirements are installed here to ensure they will be cached.
COPY ./requirements.txt /requirements.txt
RUN pip install -r /requirements.txt

# Copy project code
COPY . .

RUN python manage.py collectstatic --noinput --clear

# Run as non-root user
RUN chown -R django:django /app
USER django

# Run application
CMD python manage.py migrate
CMD gunicorn reflekt_io.wsgi:application
EXPOSE 8000
2 changes: 0 additions & 2 deletions Procfile

This file was deleted.

7 changes: 4 additions & 3 deletions about_us/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ def index(request):
if form.is_valid():
form.save()
data['success'] = True
return JsonResponse(data)
else:
data['success'] = False
return JsonResponse(data)

return JsonResponse(data)

else:
form = ContactForm()
return render(request, 'about_us_index.html', {'form':form})
Expand All @@ -41,4 +42,4 @@ def add_contact_flutter(request):
return JsonResponse({"status": "success"}, status=200)

else:
return JsonResponse({"status": "error"}, status=401)
return JsonResponse({"status": "error"}, status=401)
11 changes: 5 additions & 6 deletions reflekt_io/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@

APP_NAME = env.str('APP_NAME', '')

ALLOWED_HOSTS = []
ALLOWED_HOSTS = ['*']

if PRODUCTION:
ALLOWED_HOSTS += [f'{APP_NAME}.pbp.cs.ui.ac.id']
else:
ALLOWED_HOSTS += ['.localhost', '127.0.0.1', '[::1]']
# if PRODUCTION:
# ALLOWED_HOSTS += [f'{APP_NAME}.pbp.cs.ui.ac.id']
# else:
# ALLOWED_HOSTS += ['.localhost', '127.0.0.1', '[::1]']

# Application definition

Expand Down Expand Up @@ -166,7 +166,6 @@

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.2/howto/static-files/

Expand Down

0 comments on commit c8f8045

Please sign in to comment.