Skip to content

Commit

Permalink
updated pylint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
codewithmuh committed Jan 14, 2024
1 parent 0c519e6 commit b2bba22
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 18 deletions.
5 changes: 4 additions & 1 deletion backend/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
from .celery_conf import *
"""
Celery configuration module for backend.
"""

from .celery_conf import *
9 changes: 4 additions & 5 deletions backend/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
"""
Admin config our Admin Panel.
"""

from django.contrib import admin

from django.contrib.auth import models
Expand All @@ -9,8 +13,3 @@

admin.site.register(models.Permission)
admin.site.register(LogEntry)





14 changes: 10 additions & 4 deletions backend/celery_conf.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# celery_worker.py
"""
Celery configuration module for backend.
"""

import os
from celery import Celery
from celery import Celery, shared_task
from django.conf import settings
from celery import shared_task

# Set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')
Expand All @@ -14,10 +15,15 @@
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)

# Define Celery tasks


@shared_task(bind=True)
def debug_task(self):
print('Request: {0!r}'.format(self.request))
"""Function To Debug Task"""
print(f'Request: {self.request!r}')


@shared_task
def sample_task():
"""Function to run simple Task"""
print("The sample task just ran.")
2 changes: 1 addition & 1 deletion backend/defaults.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# This file can be used for Defaults
# This file can be used for Defaults
6 changes: 4 additions & 2 deletions backend/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
import os
from decouple import config
from celery.schedules import crontab

# pylint: disable=wildcard-import
from .defaults import *
# pylint: enable=wildcard-import

os.environ['S3_USE_SIGV4'] = 'True'
# Build paths inside the project like this: BASE_DIR / 'subdir'.
Expand Down Expand Up @@ -209,12 +212,11 @@
'default': {
'hosts': "elasticsearch:9200",
'timeout': 50, # Increase timeout to 30 seconds or more

},
}



# Celery Beat

CELERY_BEAT_SCHEDULE = {
Expand Down
9 changes: 5 additions & 4 deletions backend/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
from django.contrib import admin
from django.urls import path

from drf_yasg import openapi #new foe swagger
from drf_yasg.views import get_schema_view as swagger_get_schema_view #new foe swagger
from drf_yasg import openapi
from drf_yasg.views import get_schema_view as SwaggerGetSchemaView


schema_view = swagger_get_schema_view(
SchemaView = SwaggerGetSchemaView(
openapi.Info(
title="Your Project APIs",
default_version='1.0.0',
Expand All @@ -33,5 +33,6 @@

urlpatterns = [
path('admin/', admin.site.urls),
path('swagger/schema/', schema_view.with_ui('swagger', cache_timeout=0), name="swagger-schema"),
path('swagger/schema/', SchemaView.with_ui('swagger',
cache_timeout=0), name="swagger-schema"),
]
2 changes: 1 addition & 1 deletion manage.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
"""Django's command-line utility for administrative tasks done a."""
import os
import sys

Expand Down

0 comments on commit b2bba22

Please sign in to comment.