Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker/fix #915

Merged
merged 9 commits into from
Aug 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM python:3.8
FROM python:3.10.6

ENV PYTHONUNBUFFERED 1
RUN mkdir /bugheist
WORKDIR /bugheist
ADD . /bugheist
COPY . /bugheist


# Install PostgreSQL dependencies
Expand All @@ -18,12 +18,13 @@ RUN apt-get update && apt-get install -y \
libmemcached-dev \
libz-dev

RUN pip install pipenv
RUN pipenv install

RUN python manage.py migrate --noinput
RUN pip install poetry
RUN poetry config virtualenvs.create false
RUN poetry install

RUN python manage.py migrate
RUN python manage.py loaddata website/fixtures/initial_data.json
RUN python manage.py collectstatic
# RUN python manage.py collectstatic
RUN python manage.py initsuperuser

CMD ["python","manage.py","runserver"]
2 changes: 1 addition & 1 deletion bugheist/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")

# Allow all host headers
ALLOWED_HOSTS = [".bugheist.com", "127.0.0.1", "localhost", "bugheist-staging.herokuapp.com"]
ALLOWED_HOSTS = [".bugheist.com", "127.0.0.1", "localhost", "bugheist-staging.herokuapp.com","0.0.0.0"]

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/
Expand Down
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: "3"

services:
app:
command: "poetry run python manage.py runserver 0.0.0.0:8000"
build: .
volumes:
- .:/bugheist
ports:
- "8000:8000"
6 changes: 6 additions & 0 deletions website/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,7 @@ def get_initial(self):
return initial

def form_valid(self, form):

tokenauth = False
obj = form.save(commit=False)
if self.request.user.is_authenticated:
Expand All @@ -568,6 +569,11 @@ def form_valid(self, form):
obj.user = User.objects.get(id=token.user_id)
tokenauth = True

captcha_form = CaptchaForm(self.request.POST)
if not captcha_form.is_valid():
messages.error(self.request, "Invalid Captcha!")
return HttpResponseRedirect("/issue/")

domain, created = Domain.objects.get_or_create(
name=obj.domain_name.replace("www.", ""),
defaults={"url": "http://" + obj.domain_name.replace("www.", "")},
Expand Down