Skip to content

Commit

Permalink
update entrypoint.sh, add qodana
Browse files Browse the repository at this point in the history
  • Loading branch information
arturkrawczyk committed Feb 9, 2024
1 parent bd565f0 commit 8253da4
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 23 deletions.
19 changes: 2 additions & 17 deletions Docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,16 @@ then
echo "PostgreSQL started"
fi

#echo "Flushing manage.py..."
#
#while ! python manage.py flush --no-input 2>&1; do
# echo "Flushing manage.py..."
# sleep 3
#done

echo "Collecting static..."

while ! python3 manage.py collectstatic --no-input 2>&1; do
echo "Collecting static..."
sleep 3
done

#echo "Making migrations..."
#
#while ! python manage.py makemigrations 2>&1; do
# echo "making migrations..."
# sleep 3
#done

echo "Migrating..."

# Wait for few minute and run db migration
while ! python3 manage.py migrate 2>&1; do
while ! python3 manage.py migrate 2>&1; do
echo "Migration is in progress..."
sleep 3
done
Expand All @@ -50,4 +35,4 @@ echo "Django docker is fully configured."
echo "Running server..."

gunicorn --bind 0.0.0.0:8000 bhtom2.wsgi:application --log-level error --timeout 600 --workers 10 --threads 1 --access-logfile bhtom-access.log --error-logfile bhtom-error.log -k gevent
exec "$@"
exec "$@"
3 changes: 1 addition & 2 deletions Docker/web_Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ RUN apt update
RUN apt install -y libpq-dev
RUN apt install -y gcc g++


RUN --mount=type=cache,target=/root/.cache python -m pip install -r requirements.txt

CMD ["sh", "entrypoint.sh"]
CMD ["sh", "entrypoint.sh"]
6 changes: 3 additions & 3 deletions bhtom2/bhtom_targets/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ def target_post_save(target, created=False, user=None):

Comment.objects.create(
user_id=user.id,
user_name = user.username,
user_email = user.email,
user_name=user.username,
user_email=user.email,
object_pk=target.id,
content_type_id=12,
site_id=1,
is_public= True,
is_public=True,
comment=f"Target created by {full_name}({user.username}) on {target.created}",
)
except Exception as e :
Expand Down
4 changes: 3 additions & 1 deletion bhtom2/bhtom_targets/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ def form_valid(self, form):
messages.success(self.request, 'Target created, grabbing all the data for it. Please wait and refresh in about a minute...')

logger.info('Target post save hook: %s created: %s' % (self.object, True))
run_hook('target_post_save', target=self.object, created=True, user=self.request.user)

if target_type == Target.SIDEREAL:
run_hook('target_post_save', target=self.object, created=True, user=self.request.user)
return redirect(self.get_success_url())

def get_form(self, *args, **kwargs):
Expand Down
29 changes: 29 additions & 0 deletions qodana.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#-------------------------------------------------------------------------------#
# Qodana analysis is configured by qodana.yaml file #
# https://www.jetbrains.com/help/qodana/qodana-yaml.html #
#-------------------------------------------------------------------------------#
version: "1.0"

#Specify inspection profile for code analysis
profile:
name: qodana.starter

#Enable inspections
#include:
# - name: <SomeEnabledInspectionId>

#Disable inspections
#exclude:
# - name: <SomeDisabledInspectionId>
# paths:
# - <path/where/not/run/inspection>

#Execute shell command before Qodana execution (Applied in CI/CD pipeline)
#bootstrap: sh ./prepare-qodana.sh

#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline)
#plugins:
# - id: <plugin.id> #(plugin id can be found at https://plugins.jetbrains.com)

#Specify Qodana linter for analysis (Applied in CI/CD pipeline)
linter: jetbrains/qodana-python-community:latest

0 comments on commit 8253da4

Please sign in to comment.