Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
django-file upload request refresh
everything is ok when i am testing with django test server (manage.py runserver) but when i'm using it with apache2, after POSTing a form containing pdf file, The request with POST data get closed and a second request with no POST data is sent, enter image description here why this is happening and what i must do to solve it? -
Django - wkhtmlpdfkit 'utf-8' codec can't decode byte, invalid start byte
I use wkhtmltopdf to generate pdf, but I have problem with decode utf-8. 'utf-8' codec can't decode byte 0xfe in position 28: invalid start byte Some code with errors: area=Area.objects.get(pk=area_pk) logs=HuntingLog.objects.filter(area=area).order_by("pk") if request.POST: logs=filterLogs(request.POST['daterange'],request.session['area']) name="logs_"+datetime.now().strftime("%Y%m%d")+".pdf" temp=render_to_string("tables_raport/logs.html", {"log" : logs}) pdf=pdfkit.PDFKit(temp, "string").to_pdf() #HERE IS ERROR response = HttpResponse(pdf,content_type='application/pdf') response['Content-Disposition'] = 'attachment; filename="%s"'%(name) return response And one more: if 'cannot connect to X server' in stderr.decode('utf-8'): I use Debian. -
Django makemigrations continues to detect removing of translated fields
I'm using django 1.10 and django-modeltranslation. I've removed registrations of translated fields for my models and applied sync_translation_fields management command. But now, everytime I run makemigrations, django produce migrations to remove fields and, although I can fake these, running tests gives errors because migrations try to remove those non existing fields. How to clean up this situation? -
Django 3rd party packages not working
Good day I'm working through a Django projects book called Django by example I am stuck working through the projects because I seem to be having trouble with 3rd party packages, namely taggit and pillow Using pillow as an example.. This is the error I get when I makemigrations for my apps model: (shop) PS C:\dan_projects\django_by_example_shop\myshop> py -3 .\manage.py makemigrations SystemCheckError: System check identified some issues: ERRORS: shop.Product.image: (fields.E210) Cannot use ImageField because Pillow is not installed. HINT: Get Pillow at https://pypi.python.org/pypi/Pillow or run command "pip install Pillow". Yet 'pip freeze' is telling me that pillow is installed: (shop) PS C:\dan_projects\django_by_example_shop\myshop> pip freeze Django==1.8.5 Pillow==2.9.0 Any help would be greatly appreciated!! -
if condition within for loop of template is not working
This is my template.My for loop is working but not working when if is included. <table class="table" style="text-align: left;"> <thead> <tr> <th>Requested by</th> <th>Requested on</th> </tr> </thead> {% for request in all_requests %} <tbody> {% if request.dept is users.dept %} <td>{{ request.name }}</td> <td>{{ request.date }}</td> <td><button onclick="location.href= '/retest/{{ request.id }}/';">View details</button></td> <tr> {% endif %} </tbody> {% endfor %} </table> -
Prefetching FK objects chain in django for a Model
this question doesn't seem to have an answer since it's a slightly different problem. I have 1 abstract class and 4 concrete models hierarchically organized as below: class LevelAbstract(models.Model): class Meta: abstract = True name = models.CharField('name', max_length=255) class LevelA(LevelAbstract): class Meta(LevelAbstract.Meta): verbose_name = 'Level A' class LevelB(LevelAbstract): parent = models.ForeignKey(LevelA, related_name='children') class Meta(LevelAbstract.Meta): verbose_name = 'Level B' class LevelC(LevelAbstract): parent = models.ForeignKey(LevelB, related_name='children') class Meta(LevelAbstract.Meta): verbose_name = 'Level C' class LevelD(LevelAbstract): parent = models.ForeignKey(LevelC, related_name='children') class Meta(LevelAbstract.Meta): verbose_name = 'Level D' Now I would like to optimize this method in LevelD class that avoid multiple queries: @property def main_level(self): return self.parent.parent.parent I've tried to implement like: @property def main_level(self): self_prefetched_obj = LevelD.objects.select_related('parent', 'parent__parent', 'parent__parent__parent') return self_prefetched_obj.parent.parent.parent I'm not sure if I can call it 'optimization' as it re-fetch self object from DB and I'm wondering if there is any better way (before to take the decision to migrate to django-mptt). Thanks! -
django built in login view error messages
In django built in login view, if username or password is wrong, I want make an error messages with django messages. my template view, {% extends 'registration/base_nav.html' %} {% block content %} <div class="jumbotron"> <div class="container"> <div class="box"> <h2>Login</h2> <form class="form" method="post" action="{% url 'login' %}"> {% csrf_token %} <input type="text" placeholder="username" name="username"> <input type="password" placeholder="password" name="password"> <button class="btn btn-default full-width">Login</button> <input type="hidden" name="next" value="{{ request.path }}" /> <a class="reg" href="{% url 'signup' %}"> <p> <hr />Register. </p></a> </form> </div> </div> </div> {% endblock %} and error messages in base_nav {% if messages %} {% for message in messages %} <div class="alert alert-{{ message.tags }}" style = "height:35px;padding-top:8px;width:50%;Float:left;margin-left:10%;"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <span class="glyphicon glyphicon-ok"></span> {{ message }} </div> {% endfor %} {% endif %} -
django : ContentType.objects.get_for_model(instance.__class__) giving wrong class name
i have a model named classPost and when i use c = ContentType.objects.get_for_model(instance.__class__) it gives me output: class post and when i try to get ContentType object of model using ContentType.objects.get(model=c) it gives me error: ContentType matching query does not exist. why it is giving me this error and why get_for_model() gives me wrong class name. models.py: class classPost(models.Model): user = models.ForeignKey(settings.AUTH_USER_MODEL, default=1) title = models.CharField(max_length=120) slug = models.SlugField(unique=True, blank = True) content = models.TextField() choice = ( ('post','post'), ('anouncement','anouncement'), ('question', 'question') ) post_type = models.CharField(choices = choice, default = 'post', max_length = 12) classroom = models.ForeignKey(Classroom) updated = models.DateTimeField(auto_now=True, auto_now_add=False) timestamp = models.DateTimeField(auto_now=False, auto_now_add=True) def __unicode__(self): return self.title def __str__(self): return self.title @property def comments(self): instance = self qs = Comment.objects.filter_by_instance(instance) return qs @property def get_content_type(self): instance = self content_type = ContentType.objects.get_for_model(instance.__class__) return content_type views.py where i am using ContentType.objects.get() method. initial_data = { "content_type": instance.get_content_type, "object_id": instance.id } print(initial_data) form = CommentForm(request.POST or None, initial= initial_data) if form.is_valid() and request.user.is_authenticated(): c_type = form.cleaned_data.get("content_type") print('c_type : ',c_type) content_type = ContentType.objects.get(model=c_type) print(content_type) obj_id = form.cleaned_data.get('object_id') content_data = form.cleaned_data.get("content") parent_obj = None try: parent_id = int(request.POST.get("parent_id")) except: parent_id = None -
How to get values from this json in python?
I am currently working in python and getting some json response from API. but after trying my best to fetch data from json, i am always getting this error, TypeError: string indices must be integers, not str here is my JSON file that i received, {"from":1,"to":10,"currentPage":1,"total":72,"totalPages":8,"queryTime":"0.023","totalTime":"0.059","partial":false,"canonicalUrl":"/v1/products(categoryPath.name=All Flat-Panel TVs)?show=sku,name,salePrice&format=json&apiKey=APIKEY","products":[{"sku":3813048,"name":"Samsung - 32\" Class (31-1/2\" Diag.) - LED - 1080p - HDTV - Black","salePrice":229.99},{"sku":4340402,"name":"Samsung - 43\" Class (42.5\" Diag.) - LED - 1080p - Smart - HDTV - Black","salePrice":429.99},{"sku":4380083,"name":"Samsung - 32\" Class (31.5\" Diag.) - LED - 1080p - Smart - HDTV - Silver","salePrice":299.99},{"sku":4405201,"name":"Samsung - 50\" Class (49.5\" Diag.) - LED - 1080p - Smart - HDTV - Black","salePrice":499.99},{"sku":4559300,"name":"VIZIO - 39\" Class (38.5\" Diag.) - LED - 720p - Smart - HDTV - Black","salePrice":269.99},{"sku":4562031,"name":"Samsung - 58\" Class (57.5\" Diag.) - LED - 1080p - Smart - HDTV - Black","salePrice":649.99},{"sku":4569901,"name":"LG - 24\" Class (23.6\" Diag.) - LED - 720p - HDTV - Black","salePrice":84.99},{"sku":4613600,"name":"Samsung - 32\" Class (31.5\" Diag.) - LED - 720p - Smart - HDTV - Black","salePrice":219.99},{"sku":4629257,"name":"Samsung - 32\" Class (31.5\" Diag.) - LED - 720p - HDTV - Black","salePrice":199.99},{"sku":4673800,"name":"Insignia™ - 24\" Class (23.6\" Diag.) - LED -720p - Smart - Roku TV - Black","salePrice":139.99}]} and i have tried in following ways, for … -
Having troubles uploading image through model form
I am having trouble uploading the image field on my model form. views.py: @user_passes_test(lambda x: x.is_superuser) def add_books(request): if request.method == 'POST': form = BooksForm(request.POST, request.FILES) if form.is_valid(): form.save() redirect('/') else: form = BooksForm() return render(request, 'library/books/addbook.html', {'form': form}) models.py: class Books(models.Model): picture = models.ImageField(upload_to='images/') name = models.CharField(max_length=100) publisher = models.CharField(max_length=200) author = models.CharField(max_length=100) member = models.ForeignKey(Member, related_name="books", null=True) def get_absolute_url(self): return reverse('library:detail_book', kwargs={'book_id': self.id}) def __unicode__(self): return "%s %s" % (self, self.name, self.author) def __str__(self): return "{0} {1}".format(self.name, self.author) forms.py: class BooksForm(ModelForm): class Meta: model = Books fields = ('picture', 'name', 'publisher', 'author') def clean_name(self): name = self.cleaned_data['name'] if Books.objects.filter(name=name).exists(): raise ValidationError("A Book with that name already exists!") return name addbook.html: {% extends "library/base.html" %} {% block content %} <div align="center"> <tr> <form method="POST"> {% csrf_token %} <h2>Book:</h2> {{ form.as_p }} <input type="submit" value="submit"> </form> </tr> </div> {% endblock %} settings.py: MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media/') Once, I try to add a book and i add the image field and hit the button, the form tells me that the image field is required and it does not let me upload the image. Thank you ahead for your help! -
How to use Celery to do asynchronous tasks AWS EC2?
We set up an asynchronous task using Django, celery and rabbitMQ. Here our goal is to perform tasks like video transcoding, Thumbnail generation, Image compression and Image scaling altogether We followed the below tutorial to implement it and the asynchronous task is working properly in Localhost. For the production compatibility, we used supervisord to start celery workers and to restart in case of system reboot or crash. http://michal.karzynski.pl/blog/2014/05/18/setting-up-an-asynchronous-task-queue-for-django-using-celery-redis/ When we tried to implement same in AWS EC2, we are unable to install and configure Supervisord in AWS EC2.so we have to start celery manually every time. Can anyone please help us how to install and how to handle this procedure on AWS EC2 The code we are using task.py from __future__ import absolute_import from test_celery.celery import app import time @app.task def longtime_add(x, y): print 'long time task begins' # sleep 5 seconds time.sleep(5) print 'long time task finished' return x + y celery.py from __future__ import absolute_import, unicode_literals import os from celery import Celery import afnity.settings as settings from django.conf import settings os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'proj.settings') app = Celery('taskapp') app.config_from_object('django.conf:settings') if __name__ == '__main__': app.start() settings.py BROKER_URL = 'amqp://guest:guest@localhost//' CELERY_RESULT_BACKEND = 'redis://%s:%d/%d' % ('localhost', 6379, 0) -
django orm latest item group by each foreign key
We have following models: class Publisher(models.Model): name = models.CharField(max_length=32) local_name = models.CharField(max_length=32) url_pattern = models.CharField(max_length=128) enabled = models.BooleanField(default=True) home_page = models.BooleanField(default=False) category = models.ForeignKey(NewspaperCategory, null=True) class Newspaper(models.Model): class Meta: unique_together = ("publisher", "date") ordering = ("-date",) publisher = models.ForeignKey(Publisher) image = models.ImageField(upload_to=newspaper_upload_to) thumbnail = models.ImageField(upload_to=newspaper_thumbnail_upload_to) date = models.DateField() I have a APIView (Django rest framework) and there are several different query parameters which filter the output of API , I'd like to have a latest query parameter which list only the latest version of each publisher, also I need to be able to do further filtering and slicing on that queryset before evaluating it . but the result of query should be Newspaper instances not dict so I can feed them to my serializer . -
ImportError: No module named 'env.db' while running django server
When I only created django project and ran server everything worked, but after I started app and ran server again this error occured: Unhandled exception in thread started by <function check_errors. <locals>.wrapper at 0x7f09bff60730> Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/django/db/utils.py", line 115, in load_backend return import_module('%s.base' % backend_name) File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 986, in _gcd_import File "<frozen importlib._bootstrap>", line 969, in _find_and_load File "<frozen importlib._bootstrap>", line 944, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 986, in _gcd_import File "<frozen importlib._bootstrap>", line 969, in _find_and_load File "<frozen importlib._bootstrap>", line 944, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 986, in _gcd_import File "<frozen importlib._bootstrap>", line 969, in _find_and_load File "<frozen importlib._bootstrap>", line 944, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 986, in _gcd_import File "<frozen importlib._bootstrap>", line 969, in _find_and_load File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked ImportError: No module named 'env.db' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/django/utils/autoreload.py", line 227, in wrapper fn(*args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/django/core/management/commands/runserver.py", line 117, in inner_run autoreload.raise_last_exception() File "/usr/local/lib/python3.5/dist-packages/django/utils/autoreload.py", … -
python - Directly Send Files to S3 From Django on Heroku
So I'm trying to uploaded larger files to my site, and due to Herokus limitations with the sizes, I'm trying to upload them directly to S3. Heroku provides great documentation on how to do so, seen here. I'm following along with the guide, and adjusting my views.py based on this Git. The problem is my signing request doesn't work when trying to post to S3. I get the error The request signature we calculated does not match the signature you provided. Check your key and signing method. So i am unsure of how my signature is wrong or if there is something wrong in my javascript. Any help would be appreciated. My views.py def sign_s3(request): """ https://devcenter.heroku.com/articles/s3-upload-python """ if request.user.is_authenticated(): user = request.user.id AWS_ACCESS_KEY = AWS_ACCESS_KEY_ID AWS_SECRET_KEY = AWS_SECRET_ACCESS_KEY S3_BUCKET = AWS_STORAGE_BUCKET_NAME object_name = urllib.parse.quote_plus(request.GET['file_name']) mime_type = request.GET['file_type'] secondsPerDay = 24*60*60 expires = int(time.time()+secondsPerDay) amz_headers = "x-amz-acl:public-read" string_to_sign = "PUT\n\n%s\n%d\n%s\n/%s/%s" % (mime_type, expires, amz_headers, S3_BUCKET, object_name) encodedSecretKey = AWS_SECRET_KEY.encode() encodedString = string_to_sign.encode() h = hmac.new(encodedSecretKey, encodedString, sha1) hDigest = h.digest() signature = base64.encodebytes(hDigest).strip() print(signature) signature = urllib.parse.quote_plus(signature) print(signature) url = 'https://%s.s3.amazonaws.com/media/user_%s/%s/' % (S3_BUCKET, user, object_name) return JsonResponse({ 'data': '%s?AWSAccessKeyId=%s&Expires=%s&Signature=%s' % (url, AWS_ACCESS_KEY, expires, signature), 'url': url, }) My javascript: function … -
Efficient way to serve Django REST APIs
APIs built on Django Rest Framework. Few points before my question. I have a Employee model which is linked to seven models with different relationships among themselves. I have a seperate API for employee model I have separate APIs for each of those seven models which uses HyperLinkedModelSerializer. Now for an app calling my APIs has to make 8 requests to get all the information regarding a employee. Is this the REST compliant way to do it? or should I send all the data in a single API using ModelSerializer? or suggest me if there is another way to make the APIs more efficient. -
How to dedect image upload through api in input feild of htm?
I have a project where users have their profile and values are coming from API.I am using Django as a language. So when I add my profile photo it is working fine with the current code.And when I go to edit page of the same user it display my current image and when I again hit the save button it detect no image. my html with api value in src:- <div class="main-img-preview margin_bottom10"> <img class="thumbnails img-preview" src="{% if result_data_for_editing.profileImage.mediaPath != None %}{{ result_data_for_editing.profileImage.mediaPath }} {% else %}{{ '../assets/images/default-user-image.png' }}{% endif %}" title="Preview Logo" accept="image/*" > </div> <div class="input-group"> <div class="input-group-btn"> <div class="fileUpload btn btn_teal btn_raised text-uppercase fake-shadow"> <span>Browse</span> <input id="logo-id" name="media" type="file" class="attachment_upload" required=""> </div> </div> </div> </div> my script is this:- $(document).ready(function () { var brand = document.getElementById('logo-id'); brand.className = 'attachment_upload'; brand.onchange = function () { document.getElementById('fakeUploadLogo').value = this.value.substring(); }; function readURL(input) { if (input.files && input.files[0]) { var reader = new FileReader(); reader.onload = function (e) { $('.img-preview').attr('src', e.target.result); }; reader.readAsDataURL(input.files[0]); } } $("#logo-id").change(function () { readURL(this); }); }); how can I dedect the image from API into my input feild.PLease ignore gramatical mistakes if their are any. THanks in advance -
How to pass all the data in dataframe that extract from excel sheet to highchart?
I have a raw data and right now I need to used the raw data to plot a highchart and pass to Django, any one can share me the basic how to plot a highchart in order to shown in HTML page? I'm very new to python, Django and Highchart, I have read through all the related material on Highchart but I still not understand and not able to start it. From this https://www.highcharts.com/demo/line-basic I able to contract a chart, but in my case I need extract all the data and plot a chart. I try apply {% block content%} and the title all are base on my raw data name in a dataframe but I still not able to build a chart -
Save data with current user logged-in Django Admin
So I have this model named Report. It has a column that is linked to User model. And I have set up the authentication of users to be able to add his own report. Obviously, the authentication I've made was to only allow users to add his own report. Since the Report model is linked to User model, he can also select what user to be linked into the report he will add. Is it possible to customize this User field that it will automatically get the current logged user after creating a report? What I've done so far: I've created a dashboard where a user can log in. Created a template for the Report App to be able the user to add their own report. Set the proper authentication for users. What I don't really like about this is I can't find a way to re-use the pop-up add & edit. I found this link but haven't tried it since it seems it's already outdated. -
Authentication failed with django and mongodb
I need a little bit of help. I'm a student and I got an assignment with NoSQL databases, we need to use MongoDB (we need to do a LinkedIn sort of web app). I decided to used django since I'm trying to learn it and I've been finding some issues trying to link MongoDB to my django app. OS: Windows 8.1 Django version: 1.10 MongoDB version: 3.0.4 (since I have a 32-bits laptop) I've followed different tutorials and can't seem to get this running. I'm also using PyMongo 2.8 and Mongoengine 0.9. This is how I have my settings.py file: """ Django settings for mysite project. Generated by 'django-admin startproject' using Django 1.10.6. """ import os from mongoengine import * import pymongo # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '85!^dm*y!!wrinm@ihd_342#^3m%yab)pj3(fo99j&1iv6^my!' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'polls.apps.PollsConfig', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ] # Attempt to connecto to MongoDB MONGOADMIN_OVERRIDE_ADMIN = True MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] … -
Django Alert box
I want make alertbox(javascript alert()) in django template. When login error(wrong password or username), run the alertbox and refresh... or when register complete, run the alertbox(register success) and redirect. [% if messages %} <div class="javascript:alert"> {{ somemessage }} </div> {% endif %} like this. Thanks. -
Django, how display thing from others views in template?
I have views game, edit_rate, etc. def game(request, slug, game_id): ... return render(request, 'game.html', args) def edit_rate(request, slug, game_id, rate_id): .... return render(request, "edit_rate.html", args) I must use rate_id in game.html because I need it in: <a href="/games/{{game.id}}/{{game.slug}}/add_rate/edit/{{?rate_id?}}" </a> How I can do it? By the comment I used {% for x in game.comment_set.all %} {{x}} {% endfor %} but I don't want loop. I need one thing, I tried do this with _set, but didn't work, and I didn't find other examples with _set Rate model: game = models.ForeignKey(Games) user = models.ForeignKey(User) rate = models.IntegerField() So, how I can use rate_id in my game.html? -
Pass Django Model Object into Template Tag
I created a custom template tag to query a list of objects, but each object has a tag associated with it. I would like to pass an object as a filter into my template tag to display only certain tagged objects in my template. Template Tag @register.inclusion_tag( 'tags/_documents_snippets.html', takes_context=True ) def document_snippets(context): Document = get_document_model() documents = Document.objects.all() return { 'documents': documents, 'request': context['request'], } Template <div class="col-md-12"> <ul class="c-content-list-1 c-separator-dot c-square"> {% for doc in documents %} <li><a href="{{ doc.url }}">{{ doc.title }}</a></li> {% endfor %} </ul> </div> Tag {% document_snippets %} Can I do something like {% document_snippets|tags="AO Now" %} -
Unknown view function
I have a form that should redirect to another view function called content to predict. I receive an error saying that the form doesn't exist when it does as shown in my code: def content_to_predict(request): if request.method == "POST": form = InputForm(request.POST) if form.is_valid(): return redirect('content_to_predict') else: form = InputForm() return render(request, 'prediction/content_input.html', {'form': form}) def show_prediction_result(request): return HttpResponse('hello') What's the problem? -
Two endpoints for the same resource in django rest framework
I want to create two endpoints /comments/ and /comments/requests/ or something to that effect. The first shows your comments, and the second shows your pending comments (Comments that people sent you that you need to approve). They both work with a comments model. How could I achieve this in Django Rest Framework? Right now, my view is class CommentsListview(APIView): serializer_class = CommentSerializer def get(self, request, format=None): comments, _, _, = Comments.get_comment_users(request.user) comments_serializer = CommentSerializer(comments, many=True) return Response({'comments': comments_serializer.data}) def requests(sel,f request, format=None): _, requests, _ = Comments.get_comment_users(request.user) requests_serializer = CommentSerializer(requests, many=True) return Response({'requests': requests_serializer.data}) I'd like to allow a user to go to localhost:8000/comments/ to view their comments and localhost:8000/comments/requests/ to view their pending comment requests. Since I haven't been able to figure this out, the only other sollution would be to require the user to switch the behavior of the endpoint using a parameter as a flag /comments/?requests=True but that just seems sloppy. -
python code for pinging servers in the network and marking unresponsive servers as down
can anyone suggest me a python code for the below scenario Each server in the network regularly sends a message to each of the other servers. The recipient must acknowledge the reception of the message. If a recipient fails to do this multiple times in a row (for example, 3 times), the server is marked as down