Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Process received data from python requests library to show it in template
i am try to get live data from Raspberry pi and showing it to my django template. i could send data by 'requests' library and receiv it by Django REST. but the problem is in my django for example i post data to localhost/a how could i can render this data to localhost/b for example. i tried django session. i thought that when i in localhost/b maybe i can use session but that dose not work. rpi-req.py # this is code from Raspberry pi, to send(POST) data to django while True: # print(cam.get_frame()) da = {'rpiLive': "30 or any data"} res = requests.post(url, files=da, timeout=1000, auth=('anas', '****')) print(res.status_code) time.sleep(1) views.py inside django. # this code is from django-views, to receive data @api_view(['POST']) def video_feed(request): if request.method == 'POST': reqData = request.FILES['rpiLive'] try: return HttpResponse(gen22(request, reqData), content_type='multipart/x-mixed-replace; boundary=frame') except Exception as q: print("live Data aborted!!!", q) return HttpResponseRedirect('/live2/') return HttpResponseRedirect('/') And gen22 function is: def gen22(request, data): a = data time.sleep(0.5) con = { "anas": a, "con_tag": "live", } time.sleep(1) return render(request, "dahsboard.html", con) -
limit django fields queried in sql call to database by queryset
I have a table with a blob and would like to exclude it from being in the sql call to the database unless specifically called for. Out of the box django includes everything in the queryset. So far the only way I have found to limit the field is to add a function to the view get_queryset() def filter_queryset_fields(request, query_model): fields = request.query_params.get('fields') if fields: fields = fields.split(',') # Drop any fields that are not specified in the `fields` argument. allowed = set(fields) existing = set([f.name for f in query_model._meta.get_fields()]) values = [] for field_name in existing & allowed: values.append(field_name) queryset = query_model.objects.values(*values) else: queryset = query_model.objects.all() return queryset class TestViewSet(DynamicFieldsMixin, viewsets.ReadOnlyModelViewSet): queryset = models.TestData.objects.all() serializer_class = serializers.TestSerializer filter_backends = [django_filters.rest_framework.DjangoFilterBackend] filter_fields = ('id', 'frame_id', 'data_type') def get_queryset(self): return filter_queryset_fields(self.request, models.TestData) and mixin to the serializer to limit the fields it checks class DynamicFieldsMixin(object): def __init__(self, *args, **kwargs): super(DynamicFieldsMixin, self).__init__(*args, **kwargs) if "request" in self.context and self.context['request'] is not None: fields = self.context['request'].query_params.get('fields') if fields: fields = fields.split(',') # Drop any fields that are not specified in the `fields` argument. allowed = set(fields) existing = set(self.fields.keys()) for field_name in existing - allowed: self.fields.pop(field_name) class TestSerializer(DynamicFieldsMixin, rest_serializers.ModelSerializer): class Meta: model = … -
Message() got an unexpected keyword argument 'initial'
Where my code contains problem? I can't get it Now I am unable to see the rendered template which belongs to below url. and I see this error Message() got an unexpected keyword argument 'initial' models.py class Message(models.Model): sender = models.ForeignKey(CustomUser, related_name = 'message_sender', on_delete = models.CASCADE) reciever = models.ForeignKey(CustomUser, related_name = 'message_reciever', on_delete = models.CASCADE) message = models.TextField() def __str__(self): return f'{self.message}' def get_url(self): return reverse('profile', args = [str(self.sender.pk)]) views.py class SendMessageView(CreateView): form_class = Message template_name = 'send_message.html' urls.py path('<int:pk>/send', SendMessageView.as_view(), name = 'send_message'), -
How to redirect Login link in Password reset complete Django
Login link in DJANGO admin directs the user to accounts/login rather than account/login. How do I solve this? Error: Using the URLconf defined in tutorial.urls, Django tried these URL patterns, in this order: [name='login_redirect'] admin/ account/ The current path, accounts/login/, didn't match any of these. urls.py: urlpatterns = [ path(r'', views.login_redirect, name='login_redirect'), path('admin/', admin.site.urls), path('account/', include('accounts.urls')), ] settings.py: LOGIN_REDIRECT_URL = '/account/' Thanks -
Django Window Function FirstValue Producing Invalid SQL
I'm trying to use a window function to get the first of each group and its producing the sql query below - I took the sql and played around with it in the console and it appears that the CAST() function is causing the issue. Is there a way to get rid of this in the query? Django 2,1 Code: def contract_list(user): price_window = Window( expression=FirstValue('settle_price'), partition_by=F('contract'), order_by=F('trade_time').desc() ) market_prices = Trade.objects.filter( contract__isnull=False ).annotate( market_price=price_window ).values( con=F('contract'), market_price=F('market_price'), ).order_by( 'contract' ).all() produces this SQL run on a SQLite3 database: SELECT CAST(FIRST_VALUE("trading_trade"."settle_price") AS NUMERIC) OVER PARTITION BY "trading_trade"."contract_id" ORDER BY "trading_trade"."trade_time" DESC) AS "market_price", "trading_trade"."contract_id" AS "con" FROM "trading_trade" WHERE "trading_trade"."contract_id" IS NOT NULL ORDER BY "trading_trade"."contract_id" ASC Again, the issue seems to be related to the CAST(FIRST_VALUE("trading_trade"."settle_price") AS NUMERIC) since removing the cast function produces a result set. -
Find the addresses of subpages with articles and collect the data from them
The goal of the task is to collect data from every article from the blog. The data should be collected by processing individual HTML documents returned by the blog. I started django project and write some scrapy code but I don't know how to create code that can find the addresses of subpages with articles and collect the data from them. (from inside the articles) import requests from bs4 import BeautifulSoup page = requests.get('http://blogUrl.com/blog/') # Create a BeautifulSoup object soup = BeautifulSoup(page.text, 'html.parser') pages = [] for i in range(2, 8): url = 'http://blogUrl.com/blog/' + 'page/' + str(i) pages.append(url) for item in pages: page = requests.get(item) soup = BeautifulSoup(page.text, 'html.parser') print(soup) -
Pretty choices field for Django model
I am trying to develop a custom way to implement choices prettily for a Django model. I designed a class for choices and a custom field like this: class Choices: def __init__(self, *keys): self._keys = list(keys) def __getattr__(self, key): return self._keys.index(key) def __getitem__(self, index): return self._keys[index] def as_choices_list(self): return list(enumerate(self._keys)) class ChoicesField(models.PositiveSmallIntegerField): def __init__(self, *args, **kwargs): if isinstance(kwargs['choices'], Choices): kwargs['choices'] = kwargs['choices'].as_choices_list() super().__init__(*args, **kwargs) And my test model is: class MyModel(models.Model): TYPES = Choices('a', 'b', 'c') type = ChoicesField(choices=TYPES, default=TYPES.a) When I try to make a migration, I get the error: ValueError: 'contribute_to_class' is not in list This looks like I need to add some special implementation in my class Choices to make Django consider it as not a field. What is the best way to resolve my issue? -
channels installation on django
I am working on project to create a chat application using django for that i need channels. i tried installing channels using pip install channels. but it shows me this. error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools the above link throws page not found error what i need to do know -
It is possbile to have ALLOWED_HOSTS different configuration for some urls?
I want to have ALLOWED_HOSTS=['*'] for some urls but for the rest I want it to be ALLOWED_HOSTS=[".example.com"]. For csrf we have @csrf_exempt For cors we have the signal check_request_enabled But for ALLOWED_HOSTS? -
What is the relation between 'add_form' and 'add_fieldsets' in the Django UserAdmin?
I have added a custom user model to Django (version 2.2) using the documentation on the Django website. While my code is working fine, I am having trouble understanding the correlation between 'add_form' and 'add_fieldsets'. Specifically, in my CustomUserCreationForm, I have only included 3 fields - 'mobile' (which is my username), 'email', and 'name'. In my add_fieldsets, I have included additional fields which I have defined in my model - 'account_name' and 'gender'. However, although the 'account_name' and 'gender' are NOT defined in my add_form, everything still works fine! Can somebody help me understand why? Read the documentation on https://docs.djangoproject.com/en/2.2/topics/auth/customizing/#using-a-custom-user-model-when-starting-a-project My Model: class CustomUser(AbstractBaseUser, PermissionsMixin, GuardianUserMixin): """ Customer user model which uses the user mobile number as the username. """ mobile = models.CharField( max_length=15, unique=True, verbose_name='user mobile number', help_text='mobile number with country code (without the +)', ) email = models.EmailField(max_length=50, blank=False) name = models.CharField('full name', max_length=50, blank=False) account_name = models.CharField('company', max_length=80, blank=False) gender = models.CharField('gender', max_length=6, blank=False) is_active = models.BooleanField('active', default=False) is_staff = models.BooleanField('staff status', default=False) date_joined = models.DateTimeField('date joined', default=timezone.now) objects = CustomUserManager() USERNAME_FIELD = 'mobile' EMAIL_FIELD = 'email' # Required fields only for the createsuperuser management command. REQUIRED_FIELDS = ['email', 'name', 'account_name', 'gender'] def get_full_name(self): return self.name def … -
Prevent going back to previous page after page redirection if reload the page
I’m a social researcher and fairly new to web technology so I’m having few basic technical issues that I hope the community could help me with. I’m planning to provide online lessons and subsequently conduct some social experiments with the students. The lesson part is provided via smartsparrow https://www.smartsparrow.com/ The experimental part is implemented via Otree https://otree.readthedocs.io/en/latest/misc/django.html (it’s a Django library if I understand it correctly). I must put the experimental part into the lesson itself, which I can do this via the Iframe provided by smartsparrow. They have this very small library that help me to extract the info from smartsparrow to the webpage that is posted in their Iframe (https://github.com/SmartSparrow/simcapi-js). With this SimCapi library I was able to extract cohortId from smartsparrow to my Otree page. In Otree platform, I have separate URL for each cohortID from Smartsparrow. Thus, I made a simple Django html page with just a plain text saying students will be redirected shortly to their correct URL for their classroom. For redirecting, I simply used javascript: <script src='https://lib.smartsparrow.com/simcapi-js-3.1.0.min.js'></script> <script type="text/javascript"> var simModel = new simcapi.CapiAdapter.CapiModel({ coID: '34dsfd' }); simcapi.CapiAdapter.expose('coID', simModel, {alias: 'cohoID'}); simcapi.Transporter.addInitialSetupCompleteListener(init); function init(args) { cohortID = simcapi.Transporter.getConfig().cohortId; console.log(cohortID) simModel.set('coID', cohortID); var dict … -
What's the most efficient way to make a 5 tables join in django ORM?
database model I'm trying to get the inner join between contentprofile with contentaddresources to integrate easily with some system I wrote a raw query in django's ORM to get the desired result Query: select * from manager_contentaddresource cas inner join manager_contenttemplate ct on cas.content_template_id = ct.id inner join manager_mediaitem mi on mi.content_template_id = ct.id inner join manager_medialistitems mli on mli.media_id = mi.id inner join manager_medialist ml on mli.media_list_id = ml.id inner join manager_contentprofile cp on cp.media_list_id = ml.id where cp.id = 1 so is this an overhead? is there's more efficient way to do this join? thank you -
include extra field in nested serializer with throuth model Django
I'm writing a meal tracker, so there are two models, Recipe and Ingredient, which are connected through model RecipeIngredient with extra field quantity. Here's my models.py: class Recipe(models.Model): name = models.CharField(max_length=100) recipe = models.CharField(max_length=200) ingredients = models.ManyToManyField(Ingredient, through="RecipeIngredient", related_name='recipes') class RecipeIngredient(models.Model): recipe = models.ForeignKey(Recipe, on_delete=models.CASCADE, unique=False) ingredient = models.ForeignKey(Ingredient, on_delete=models.CASCADE) quantity = models.IntegerField(blank=False) class Ingredient(models.Model): id = models.AutoField(primary_key=True, db_column='ingredient_id') name = models.CharField(max_length=100) calories = models.IntegerField(blank=True) views.py: class RecipeViewSet(viewsets.ModelViewSet): queryset = Recipe.objects.all() serializer_class = RecipeSerializer permission_classes = (AllowAny,) def get_queryset(self): return Recipe.objects.annotate( total_ingredients=Count('ingredients'), total_calories=Sum('ingredients__calories'), total_quantity=Sum('recipeingredient__quantity') ) class IngredientViewSet(viewsets.ModelViewSet): queryset = Ingredient.objects.all() serializer_class = IngredientSerializer permission_classes = (AllowAny,) serialziers.py: class RecipeSerializer(serializers.ModelSerializer): ingredient_list = IngredientSerializer(source='ingredients', many=True, required=False) total_ingredients = serializers.IntegerField(required=False) total_calories = serializers.IntegerField(required=False) total_quantity = serializers.IntegerField(required=False) class Meta: model = Recipe fields = ('id', 'name', 'ingredient_list', 'recipe', 'total_ingredients', 'total_calories', 'total_quantity') depth = 1 class IngredientSerializer(serializers.ModelSerializer): class Meta: model = Ingredient fields = ['id', 'name', 'calories'] So far, my response looks like this: { "id": 1, "name": "testrecipe", "ingredient_list": [ { "id": 1, "name": "ing0", "calories": 2 }, { "id": 2, "name": "ing1", "calories": 4 }, { "id": 3, "name": "ing2", "calories": 4 } ], "recipe": "recipe discription here", "total_ingredients": 3, "total_calories": 10, "total_quantity": 30 }, I want to include quantity for each ingredient … -
Retrieve form data
I created checkboxes with form for filter data from my model. JavaScript code add textbox when checkbox is enabled. My problem is that I don't know how to retrieve data from textbox and filter by view my template. Example of my code: Views.py def filtar(request): form = ChoiceForm(request.GET or None) data = Clanak.objects.all() if form.is_valid(): if 'name' in form.cleaned_data['filter']: data = data.filter(naslov=form.cleaned_data['name']) if 'year' in form.cleaned_data['filter']: data = data.filter(datumObjave__year=form.cleaned_data['2019']) return render(request, 'filtar.html', {'data': data, 'form': form}) forms.py class ChoiceForm(forms.Form): filter = forms.MultipleChoiceField(choices=(('year', 'Year'), ('name', 'Name')), widget=forms.CheckboxSelectMultiple(attrs={'id': 'choice', 'class': 'myclass'})) models.py class Clanak(models.Model): naslov = models.CharField(null=False, blank=True, max_length=120) datumObjave = models.DateField(null=False, blank=False) autor = models.ForeignKey(Autor, on_delete=models.CASCADE, null=True) videofile= models.FileField(upload_to='images/', null=True, verbose_name="") def __str__(self): return str(self.naslov) + ', ' + str(self.datumObjave) + ', ' + str(self.autor) + ', ' + str(self.videofile) footer.html <!DOCTYPE html> <html> <head> <style> input[type=submit] { padding:5px 15px; background:#ccc; border:0 none; cursor:pointer; -webkit-border-radius: 5px; border-radius: 5px; display:block; } input[type=checkbox] { display:block; } </style> </head> <body> <form action="" method="POST">{% csrf_token %} {{ form.as_p }} <input type="submit" value="Apply" /> </form> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $('.myclass').click(function(){ $(this).prop('checked') ? $('form').append(`<input id="${$(this).val()}input" style="display:block;margin:5px" placeholder="${$(this).val()} details"></input>`) : $(`form #${$(this).val()}input`).remove(); }); </script> </body> </html> Image: My problem is that filters don't work at all, page just refresh … -
Syntax error on line 26 of /etc/httpd/conf.d/wsgi.conf: Name duplicates previous WSGI daemon definition
I am getting the following error during the time of installing let's encrypt SSL in AWS elastic beanstalk. Steps were taken for installing the ssl: sudo -y install mod24_ssl sudo git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt sudo /opt/letsencrypt/letsencrypt-auto --debug -d www.example.com Error: Obtaining a new certificate Performing the following challenges: http-01 challenge for www.example.com Waiting for verification... Cleaning up challenges Created an SSL vhost at /etc/httpd/conf.d/wsgi-le-ssl.conf Deploying Certificate to VirtualHost /etc/httpd/conf.d/wsgi-le-ssl.conf Error while running apachectl configtest. [Thu May 23 11:37:20.146374 2019] [so:warn] [pid 26550] AH01574: module wsgi_module is already loaded, skipping AH00526: Syntax error on line 26 of /etc/httpd/conf.d/wsgi.conf: Name duplicates previous WSGI daemon definition. Unable to run the command: systemctl restart httpd Rolling back to previous server configuration... Exiting abnormally: Traceback (most recent call last): File "/opt/eff.org/certbot/venv/bin/letsencrypt", line 11, in <module> sys.exit(main()) File "/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/certbot/main.py", line 1379, in main return config.func(config, plugins) File "/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/certbot/main.py", line 1137, in run _install_cert(config, le_client, domains, new_lineage) File "/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/certbot/main.py", line 763, in _install_cert path_provider.cert_path, path_provider.chain_path, path_provider.fullchain_path) File "/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/certbot/client.py", line 520, in deploy_certificate self.installer.restart() File "/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/certbot_apache/configurator.py", line 2162, in restart self.config_test() File "/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/certbot_apache/override_fedora.py", line 49, in config_test self._try_restart_fedora() File "/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/certbot_apache/override_fedora.py", line 64, in _try_restart_fedora raise errors.MisconfigurationError(str(err)) MisconfigurationError: Unable to run the command: systemctl restart httpd wsgi.conf: LoadModule wsgi_module … -
How to port django 1.11 to django 2.2 and python 2.7 to 3.5?
I need main points which could crash my code when porting a project that is in Django 1.11 with python 2.75 to Django 2.2 with python 3.5 .If someone can point me to the links or give a detailed summary about things i should make sure to correct while porting the code . I have read this guide for porting python2 to python3 .https://www.digitalocean.com/community/tutorials/how-to-port-python-2-code-to-python-3.Anything else will be highly appreciated . -
Django (DRF) fails to POST data to url with similar path
In my url conf I have two similar patterns: urlpatterns = [ path('chat/', views.chat), # create chat path('chat/message/', views.search), # create message ] The second path works as expect, however, when I try to POST data to chat/ I get error 405 and {"detail":"Method \"POST\" not allowed."} error message. The code in the view works, if I modify chat/ to something more specific like chat/create/ then everything works fine. However, this is not what I want to do. I thought django would match the first URL that matches the request. Why is this happening? It this bug or expected behavior? -
Matching query doesn't exist?
I am making a retweet function and it works quite smooth but I am not able to retweet my own tweets , I am able to retweet other users tweets but not mine . It shows that matching query doesn't exist. Here is the tweets models class TweetManager(models.Manager): def retweet(self,user,parent_obj): if parent_obj.parent: obj_parent = parent_obj.parent else: obj_parent = parent_obj qs = self.get_queryset().filter(user = user, parent = obj_parent) if qs.exists(): return None obj = self.model( user = user, parent = obj_parent, content = parent_obj.content ) obj.save() return obj class Tweet(models.Model): parent = models.ForeignKey("self",blank = True,null = True) user = models.ForeignKey(settings.AUTH_USER_MODEL) content = models.CharField(max_length = 130) time = models.DateTimeField(auto_now_add = True) objects = TweetManager() def __str__(self): return self.content class Meta: ordering = ['content'] Here's the views.py class Retweet(View): def get(self, request, pk, *args, **kwargs): tweet = get_object_or_404(Tweet, pk=pk) if request.user.is_authenticated: new_tweet = Tweet.objects.retweet(request.user, tweet) return HttpResponseRedirect("/") return HttpResponseRedirect(tweet.get_absolute_url()) -
Django import error when starting sever with pipenv
I am trying to runserver for my django app on Windows. I used to do it trough Anaconda, but I reinstalled it to Anaconda3 yesterday and I am getting this error after starting pipenv shell and then runserver. Traceback (most recent call last): File "manage.py", line 8, in <module> from django.core.management import execute_from_command_line File "C:\Users\norchi\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\django\__init__.py", line 1, in <module> from django.utils.version import get_version File "C:\Users\norchi\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\django\utils\version.py", line 1, in <module> import datetime ModuleNotFoundError: No module named 'datetime' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "manage.py", line 14, in <module> ) from exc ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment? Here are some things I tried: I tried updating the PATH vars and I also added a PYTHONPATH = C:\Users\norchi\AppData\Local\Programs\Python\Python37-32 I installed django using pipenv and using pip outside of the virtual environment. python show django outputs that the path for django is C:\Users\norchi\AppData\Local\Programs\Python\Python37-32\Lib\site-packages -
Do I need to create virtual environment through terminal?
I am creating a new Django project through PyCharm, I already have Virtualenv selected instead of conda, so do I have to create a virtual environment through the terminal and install all libraries? I am not planning to upload this site on domain or server, it's for my learning, will upload it on Heroku or similar thing to show my practice and work to people. -
Queryset Django - according to parameters date in weight compartment
I'm trying to get a result where my data from the database is sorted first by weight and then by date. My models.py look like this: class Example(models.Model): date_created = models.DateTimeField(auto_now_add=True) weight = models.PositiveIntegerField(default=1, validators=[MinValueValidator(1), MaxValueValidator(3)]) If I add in my object: class Meta: ordering = ['-date_created '] and in the queryset will filter out after the weight I get the result as in the picture below? How to get such a result using only query, or only using the class in the models.py file? I apologize if my question is not clear enough. But the picture shows what I would like to get. Any help will be appreciated. -
How to fix "Error loading psycopg2 module: No module named 'psycopg2" [duplicate]
This question already has an answer here: Django/Python Beginner: Error when executing python manage.py syncdb - psycopg2 not found 15 answers I deployed my django application with sqlite3, uwsgi emperor mode and python v3.6.7 on ubuntu 18.04 Now I changed database to postgresql, every thing worked fine in my local machine, but in the server when I run uwsgi server.ini (for testing purpose) I get this error: django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: No module named 'psycopg2' and application just shows "Internal Server Error" in the browser. psycopg2 is installed in my virtualenv I installed python-psycopg2 using apt-get too I can import psycopg2 in the python shell without any error django will run without any problem using python manage.py runserver I did not use sudo with pip to install psycopg2 django settings.py configs are right, because I performed migrations I read all similar problems and tried their answers, nothing worked :( -
How i can loop thought for loop and use ajax to show result in django?
I have a question about django and ajax, i want to show result of forloop with ajax. I have code below when i submit button, my html doesn't append data of ajax call. Anyone have solotion about this. Thanks for answer This is my view def test_ajax(request): if request.method == 'POST': for i in range(10): helloworld(i) return render(request, 'test_ajax.html') def helloworld(request, i): data = { 'status': i } return JsonResponse(data) This is my url path('testajax/', test_ajax), path('helloworld/<int:i>/', helloworld, name='ajaxsend') And this is my html file{% extends 'base.html' %} {% extends 'base.html' %} {% block content %} <div class="container"> <h1>Hello World</h1> <form id="test" method="POST"> {% csrf_token %} <input type="text" id="id_username"> <button type="Submit" class="btn btn-secondary">Check Token Live</button> </form> <div id="people"> </div> </div> {% endblock content %} {% block script %} <script> $("#test").on('submit', function (e) { e.preventDefault(e); $("#people").html('<h2>Hello World</h2>'); $.ajax({ url: "/helloworld/", success: function(result){ alert('Hello world'); console.log(result.status) $("#people").append('<h2>' + result.status + '</h2>'); } }); }); </script> {% endblock script %} -
Is there a way to put interactive matplotlib graphs in django webpages?
I want to make an interactive plot, so that clicking on a position on the plot, shifts the plot to the position. I have implemented it in matplotlib or PyQt. But I don't know how to make interactive matplotlib graphs in webpages (particularly django). Is there any way to detect click locations on matplotlib plots which are shown in a browser? Thank you -
Exception in thread django-main-thread
While running my server python manage.py runserver A typeError occured Trace back of this error is: Watching for file changes with StatReloader Exception in thread django-main-thread: Traceback (most recent call last): File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/usr/lib/python3.6/threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "/home/akshay/django/google_login/myvenv/lib/python3.6/site-packages/django/utils/autoreload.py", line 54, in wrapper fn(*args, **kwargs) File "/home/akshay/django/google_login/myvenv/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run autoreload.raise_last_exception() File "/home/akshay/django/google_login/myvenv/lib/python3.6/site-packages/django/utils/autoreload.py", line 77, in raise_last_exception raise _exception[0](_exception[1]).with_traceback(_exception[2]) TypeError: __init__() missing 2 required positional arguments: 'doc' and 'pos'