Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Can't figure out DeclarativeMeta error with alembic and sqlalchemy in django project
I could use some help figuring out how to debug this: I suspect that there is something wrong with my models.py file but the error messages are pretty vague. Using Alembic and sqlalchemy instead of Django ORM (relatively new to all the above) and successfully made a migration and migrated it to alembic version folder. Whole reason I'm using alembic sql alchemy is because I am trying to hit external api and was told in another post that alembic was needed to manage migration histories or there would be issues with django tracking migrations. I have a custom command class that calls the scraper and I am passing the data to pandas dataframe then attempt to write it to database defined in my models.py file. For brevity I will just post my models.py, the end of the error log as well as link to full repo from datetime import datetime from sqlalchemy import Column, Integer, DateTime, String, Numeric, BigInteger, UniqueConstraint from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() from django.db import models class CMC(Base): __tablename__ = 'apis_cmc' id = Column(Integer, primary_key=True) inserted_at = Column(DateTime, default=datetime.utcnow) name = Column(String) symbol = Column(String) price = Column(Numeric) market_cap = Column(BigInteger) market_cap_dominance = Column(BigInteger) fully_diluted_market_cap … -
django connect remote postgresql
Trying to connect to a remote server, serving my posgresql My settings.py DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'mydatabase', 'USER': 'mydatabaseuser', 'PASSWORD': 'mypassword', 'HOST': 'ubuntu@username.host.com', 'PORT': '5432', } } Getting error: django.db.utils.OperationalError: could not translate host name "ubuntu@hostname.host.com" to address: Name or service not known Where the hostname and host is of course not hostname and host, just using for this example. -
Trouble posting to many-to-many field
I am trying to post a combination object, which refers to already existing tag objects. Basically I want the tag_id field of the combination to include 2 ids referring to Tag objects. This is my code: models.py class Combination(models.Model): user = models.ForeignKey(CustomUser, on_delete=models.SET_NULL, null=True) gameround = models.ForeignKey(Gameround, on_delete=models.CASCADE, null=True) resource = models.ForeignKey(Resource, on_delete=models.CASCADE, null=True) tag_id = models.ManyToManyField(Tag, null=True) created = models.DateTimeField(editable=False) score = models.PositiveIntegerField(default=0) objects = models.Manager() def __str__(self): return str(self.tag_id) or '' serializers.py class CombinationSerializer(serializers.ModelSerializer): tag_id = TagWithIdSerializer(many=True, required=False) resource_id = serializers.PrimaryKeyRelatedField(queryset=Resource.objects.all(), required=True, source='resource', write_only=False) gameround_id = serializers.PrimaryKeyRelatedField(queryset=Gameround.objects.all(), required=False, source='gameround', write_only=False) user_id = serializers.PrimaryKeyRelatedField(queryset=CustomUser.objects.all(), required=False, source='user', write_only=False) class Meta: model = Combination depth = 1 fields = ('id', 'user_id', 'gameround_id', 'resource_id', 'tag_id', 'created', 'score') def create(self, validated_data): user = None request = self.context.get("request") if request and hasattr(request, "user"): user = request.user score = 0 tag_data = validated_data.pop('tag_id') combination = Combination( user=user, gameround=validated_data.get("gameround"), resource=validated_data.get("resource"), created=datetime.now(), score=score ) for tag_object in tag_data: combination.set(tag_id=tag_object) if len(combination.tag_id) == 2: return combination def to_representation(self, instance): rep = super().to_representation(instance) rep['tag_id'] = TagWithIdSerializer(instance.tag_id.all(), many=True).data return rep With this I am currently getting an AttributeError : 'Combination' object has no attribute 'set' How can I get rid of this? -
Page not found(404),Current path didn't match any of these
Views.py From django.http import HttpResponse def home(request): Return HttpResponse('Hello World') urls.py(my_app) From Django.urls import path From . Import views Urlspatterns=[ Path(' ',views.home) ] Main urls From django.urls import path, include From Django.contrib import adim Urlspatterns=[ Path('admim/',.....) Path(' ',include('my_app.urls)) Settings.py Installed apps=[ " ", " ", 'my_app', ] Why I run the server it tells me page not found, ....... current empty path didn't match any of these, my Django has been working fine until recently, even if I start a new project from scratch it ends up with same result, I'm actually at the edge of giving up on Django ,I really need help please.... thanks in advance -
RedisCache' object has no attribute 'ttl'
hello friends in new project i use Django4 and i set the "django.core.cache.backends.redis.RedisCache" for the cache but i have the error it say "AttributeError: 'RedisCache' object has no attribute 'ttl'" .it refer to the line of my code that i add it below : from django.core.cache import cache def validate_token(token, check_time=True): if cache.ttl(token) == 0: return False try: data = claim_token(token) except Exception: return False if "type" not in data.keys(): return False can anyone tell me how i can resolve it ? (i know ttl mean time to live) -
Converting RGB PDF in CMYK with plain black using ghostscripts sOutputICCProfile
currently i am generating a pdf using weasyprint version 52.5. The pdf generated is in RGB but i need it in CMYK for printing. Now i tried converting it using ghostscript version 9.50 which works just fine, but my generated PDF always consists of texts in rich black. I did find a solution to convert the RGB(0,0,0) to plain black(K=100%). I tried the hack described in this issue: Converting (any) PDF to black (K)-only CMYK. But this only worked if my pdf didn't consists any transparent objects which i have, else ghostscript would render my PDF to a bitmap which i don't want. Now instead of using the hack, the ghostscript support recommended using ICC profiles to accomplish the same result: https://bugs.ghostscript.com/show_bug.cgi?id=704872. So i had to consult my printer to provide me with an icc profiles which i should use instead of the hack. And here is the problem, i can't get to make ghostscript use and embedd the ICC profile into the pdf. It seems ghostscript converts the pdf to cmyk but i think its using the defaul_cmyk.icc profile and not my specified icc profle. Also i don't realy think that the ICC profile from my printer is the … -
Fetching data to Django view working manually but not with Selenium. Why?
I am using Selenium to test a Django app I have created. The following code works fine 'manually' but does not work with Selenium. Why ? ## dummy.html ## {% extends 'main.html' %} {% load static %} {% block title %} Dummy page {% endblock title %} {% block meta %} <meta name="robots" content="noindex"> {% endblock meta %} {% block content %} <div class="container"> <div class="row"> <div class="col d-flex justify-content-center align-items-center"> <h1 class="text-primary font-handwriting">Dummy page</h1> </div> </div> <br> <div class="row"> <div class="col d-flex justify-content-center align-items-center"> <h2 class="text-primary font-heading">THIS IS A DUMMY PAGE</h2> </div> </div> <br> <div class="row"> <button id="trigger-dummy-button" type="button" class="btn btn-primary text-white font-base fw-bold text-uppercase" title="Trigger dummy button">Trigger dummy button</button> </div> </div> <script> var someDummyURL = "{% url 'home_page:another_dummy_view' %}"; </script> <script type="module" src="{% static '/js/dummy.js' %}"> </script> {% endblock content %} ## dummy.js ## 'use strict'; var newValue; async function postDummyFunction(request) { var response = await fetch(request); if (response.ok) { var updatedReturnedValue = await response.json(); newValue = updatedReturnedValue.returnedValue; alert('-- postDummyFunction -- | newValue = ' + newValue); // When the script is triggered manually by clicking, response.ok = true and newValue = "Hello World OK !" return newValue; } else { // When the script is triggered by … -
What is causing the '403 Forbidden error' in my Apache2 server? And how can I fix it? The available fixes on the web are not working for me
A little bit of context to my problem... I'm trying to deploy my django application following a tutorial (https://www.youtube.com/watch?v=Sa_kQheCnds) which uses linode to setup a linux apache server, and after following the steps, it always results in the same error, 403 Forbidden: You don't have permission to access this resource. I've followed the steps in this guide roughly 6 times now and I've determined that I'm definitely not doing anything the guy didn't do. Something worth mentioning is that in the tutorial, Ubuntu 18.10 is being used, however I don't have Ubuntu 18.10 available, so I've tried it using Ubuntu 18.04, 20.04 and 21.10. In my sixth and latest attempt, I am using Ubuntu 21.10 I've also tried running the server with DEBUG=True to see if I can get a little more insight on the error, but it just displays the following: The tutorial is very long so I've broken down every single step in this post. The steps I had to follow are: (everything done in the Windows Linux Bash shell) Creating Linode and analizing Ip Address and SSH Credentials I got Root Connection to the Server ssh into the server for the first time Installing Software Updates Running … -
Is there any way to get notifications to admin site in Django when new instances of models are created in database?
I am thinking of creating a website where users will add posts and basically I will check whether the posts are are valid or not in the Admin site. I was looking if it was possible to have some type of notification inside the admin every time someone posts or else I have to refresh the admin again and again everyday and continuously look for changes. Any sort of alternative solutions would also be appreciated. Thanks. -
Why I failed to connect to the django server?
enter image description here Please forgive me for the poor English expression. I follow the tutorial, use the command: python3 manage.py runserver 0.0.0.0:8080 in docker container and start django server like the picture. But I can not connect to it by IP. I am sure that I have already open the 8000 port and this port is on listening.By the way, I use the ubuntu and set the server in the aliyun. I am so confused with it and I can find the answer online (maybe my searching skill is bad). so I am asking for help.Thanks -
How to add additional image field not present in django forms
I need similar solution as provided in one issue over stackoverflow named as "Additional field in django form". But i want to use image field rather then input. Can anyone help? -
Can´t see user menu django-jazzmin
Hello I am having an issue with django-jazzmin. I can´t see the usermenu on the navbar I mean is there but even though i change the navbar colour it can't bee seen.In this first image you can see the issue even changing the navbar colour In thi second image you can see the issue even changing the navbar colour -
django-security-session: issue with session variable lost when session expired
I develop an app and I have some session variables used in views. I use django-security-session to logout user. But when user login after being logout with django-security-session, it is redirected to the last visited page/view, as it is supposed to be (normal django-security-session behaviour). But my issue, is that using session variable in views, when user is lougout, session variables are lost, and error is raised. Maybe I am do not have good "pratices" using sessions variables this way... but for now, I would like to keep using if possible. How can I manage this issue? settings.py SESSION_SECURITY_WARN_AFTER = 14*60 SESSION_SECURITY_EXPIRE_AFTER = 15*60 views.py @method_decorator(login_required, name="dispatch") class EligibiliteUpdate(SuccessMessageMixin, UpdateView): model = Eligibilite form_class = EligibiliteForm template_name = "ecrf/eligibilite_form.html" # nom template à utiliser avec CBV : [nom_model]_form.html success_message = "La fiche Eligibilite a été modifiée." def get_success_url(self): return reverse("ecrf:patient", args=[Patient.objects.get(pat = Eligibilite.objects.filter(ide = self.kwargs["pk"]).first().pat.pat).ide]) def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) patient = self.request.session.get("patien # <= session variable lost when user is logout context["form_name"] = "eligibilite" context["ide"] = self.kwargs["pk"] context["exist"] = Eligibilite.objects.filter(pat = patient.ide).exists() # <= error raised # creation context["eli_sai_log"] = Eligibilite.objects.get(ide = self.kwargs["pk"]).eli_sai_log context["eli_sai_dat"] = Eligibilite.objects.get(ide = self.kwargs["pk"]).eli_sai_dat # lock context["is_locked"] = Eligibilite.objects.get(ide = self.kwargs["pk"]).ver context["user_has_lock"] = Eligibilite.objects.get(ide … -
Unable to create process using 'C:\Users\Abhishek Anand\AppData\Local\Programs\Python\Python310\python.exe manage.py runserver'
I'm trying to use runserver command over vs code terminal. But now it is giving me the error. " Unable to create process using 'C:\Users\Abhishek Anand\AppData\Local\Programs\Python\Python310\python.exe manage.py runserver'". But I have the python interpreter in my environment path. Also, I have my virtual environment which I created while initiating the project but still and using the interpreter in my environment I was getting the same error.. Please help me out with that.enter image description here -
Django Image Field default image clear
I've cleared Django Image Field default image from django admin panel. Now im getting error viewing the webpage in browser. So how can I undo this. If i set another image it's working well. But i can't leave this empty, is there any solution>>> django-admin default image -
Django - Retieve Data from Reservation Form and Display back to User
Trying to pull data from my Database and display it back to the user so they can edit/delete it for full CRUD functionality. At the moment when i iterate through the reservations it comes back empty. Below is the relevent code: Models.py file: class Reservations(models.Model): name = models.CharField(max_length=50) phone_number = models.CharField(validators=[phoneNumberRegex], max_length=16, unique=True) email = models.EmailField() date = models.DateField() time = models.CharField(choices=time_options, default="12pm", max_length=10) number_of_party = models.IntegerField(choices=party_size, default=1) reservation_id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False, max_length=15) Then the forms.py file: class ReservationForm(forms.ModelForm): class Meta: model = Reservations fields = ['name', 'phone_number', 'email', 'date', 'time', 'number_of_party'] widgets = { 'date': DatePickerInput(format='%d-%m-%Y'), } Views.py: class RetrieveReservationView(ListView): model = ReservationForm Path in the Urls.py file: path('retrieve/<slug:pk>/', RetrieveReservationView.as_view(), name="retrieve_reservation"), And Finally the Html file associated with it: <ul> <!-- Iterate over reservations list --> {% for reservation in reservations %} <!-- Display Objects --> <li>{{ reservation.name }}</li> <li>{{ reservation.phone_number }}</li> <li>{{ reservation.email }}</li> <li>{{ reservation.date }}</li> <li>{{ reservation.time }}</li> <li>{{ reservation.number_of_party }}</li> <hr/> <!-- If object_list is empty --> {% empty %} <li>No Reservation have been made</li> {% endfor %} </ul> At the moment i just keep getting back "No Reservation has been made" but i have two/three in the database for the user logged in. … -
Django Rest API: Using both token authentication and session authentication
I've tried to implement two ways of logging into the Django API: token-based authentication and session authentication. Token based authentication works fine when session based authentication isn't implemented, but when I activate session based authentication, the token based authentication endpoint only returns ""CSRF Failed: CSRF token missing or incorrect". Now, I know with session based authentication I need to set the csrf header, but is there a way to bypass this for specific endpoints, or for when a token auth header has been included in the request? Thanks for any answers :) -
Django 4.0 - Saving Multiple Options using MultipleChoiceField
I am trying to save Multiple Choice Fields in an array inside my database I have no idea how to do this, I have a working solution by using the standard ChoiceField but it only saves one option at the moment I want my values inside the database to show as for example "Beavers, Cubs" or "Scouts, Cubs" How can I change my current code to do this? (This is only my 2nd question so any constructive criticism will be appreciated) models.py class User(AbstractBaseUser, PermissionsMixin): # A full User model with admin-compliant permissions that uses a full-length email field as the username # Email and password are required but all other fields are optional email = models.EmailField(_('email address'), max_length=254, unique=True) username = models.CharField(max_length=50, unique=True) first_name = models.CharField(_('first name'), max_length=30, blank=True) last_name = models.CharField(_('last name'), max_length=30, blank=True) section = models.CharField(max_length=30) is_active = models.BooleanField(_('active'), default=True, help_text=_('Designates whether this user should be treated as active. Unselect this instead of deleting accounts.')) is_staff = models.BooleanField(_('staff status'), default=False, help_text=_('Designates whether the user can log into this admin site.')) is_executive = models.BooleanField(_('executive status'), default=False, help_text=_('Designates that this user is part of the executive committee.')) is_superuser = models.BooleanField(_('superuser status'), default=False, help_text=_('Designates that this user has all permissions … -
Django template regorup
I want to regroup this on the basis of ingredients. this is my sample result which I want Ingredient_name, all the stop names associated with that ingredient, all the stop_longitude associated with that ingredient and so on in one table row. model class SupplyChainStops(models.Model): ingredient = models.ForeignKey(Ingredients, null=True, on_delete=models.CASCADE) stop_name = models.CharField(max_length=1024, null=True, blank=True) stop_longitude = models.CharField(max_length=500, null=True, blank=True) stop_latitude = models.CharField(max_length=500, null=True, blank=True) is_supplier = models.BooleanField(default=False, blank=True, null=True) def __str__(self): return f'{self.stop_name}' query items = SupplyChainStops.objects.all() template {% for item in items %} <tr class="text-black"> <td>{{ item.ingredient }}</td> <td>{{ item.stop_name }} <td>{{ item.stop_longitude }} <td>{{ item.stop_latitude }} -
How can we get all usernames list only not user objects with django ORM
I want to know that how can we get list of required field data from django models. In my case i want to get all usernames from users models. receivers = User.objects.all() this return all users objects. I want to get usernames directly. Something like below: receivers = User.objects.all(username) output: ["ahmed","dummy","hamza","sentence"] in sql query looks like below: SELECT username from USER -
How to prevent use of urls outside mysite
I am creating a small website to download free games. I uploaded the games to my database via filefield. I have a link like this : domain.com/media/games/game_name.exe The question here is: 1 - How do I prevent this link from being copied from my site and used on other sites. 2 - How to redirect the link to my site if it is used on another site. this is my models: class games(models.Model): class Meta : verbose_name_plural = 'games' game_title = models.CharField(max_length=50) game_requirements = models.CharField(max_length=100) game_picture = models.ImageField(upload_to='images') game_desc = models.TextField() game_size = models.CharField(max_length=20) game_upload = models.fileField(upload_to='games') def __str__(self): return self.game_title this is my media_config: MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') this is my download_template_url: {% for game in all_games %} <a href="{{game.game_upload}}">download<i class="fa fa-download"></i></a> {% endfor %} this is my views: def download(requset,game_title): all_games = games.objects.filter(game_title=game_title) context ={ 'all_games' :all_games, } return render( requset,'download.html',context) Thanks in advance. -
How to add additional function to form submit button in Django
I have a form and a submit button for it, how can I add additional functionality to this button, like for example I want to call sendNotification function when submit button is pressed. I googled and so far understand that this can be done by adding "onclick" javaScript function to that Submit button but then I need to call sendNotification in javaScript which seems to me kind of doing stuff around the corner, so I was wondering if there is some way to add function call to Submit button directly? #updateProduct.html <h1 style="font-size: 20px; margin-left: 10px;" class="p-2"> Update Job </h1> <div class="container m-1"> <form id=form action="" method="post" enctype="multipart/form-data"> {% csrf_token %} {{ form.as_p }} <input type="submit" name="Save Changes" class="btn btn-success m-0" value="Save Changes"> <a class="btn btn-primary mt-0" href="{% url 'showProducts' %}" > Cancel </a> </form> <!--This button below separately works but can it be integreted to the submit button above--> <a href="{% url 'sendNotification' id email %}" class="btn btn-success" >Notify</a> </div> Below is the sendNotification function itself #views.py @login_required(login_url='sendNotification') def sendNotification(request, pk, email): product = Product.objects.get(id=pk) msg = EmailMessage() msg.set_content(product.description + " Here is the link for details: ZZZ+str(pk)+"/" ) msg['subject'] = product.name msg['to'] = email user = "XX@gmail.com" msg['from'] … -
name 'displayhtml' is not defined in python 3.7
I have upgraded my code from Django 1.8 to Django 3.0 and my python version is python 3.7 when i deploy my code to dev server i m getting this issue "name 'displayhtml' is not defined" my requirements.txt django-recaptcha== 2.0.6 settings.py file INSTALLED_APPS = [ .... .... 'captcha', ] here is my views.py def enquiry_external(request, client_pk): form_data={} admin = ClientUser.objects.filter(client_id=client_pk,is_admin=True)[0].id user_id = request.user public_key = settings.RECAPTCHA_PUBLIC_KEY script = displayhtml(public_key=public_key) id = request.GET.get('gid','') ..... ..... ..... I couldn't understand why i m getting this error -
The dynamic data in my Django project doesn't change after I change the data
My Django project is linked with dynamic data from my google sheet API. However, when I edit on my google sheet and reload the page, the data doesn't change accordingly. I have to manually reload the server to refresh all the changes. I used gspread and pandas to convert my google sheet into a list of dictionaries. I was advised that I am reading the google sheet once, outside the view handling function. That only gets executed once while Django is starting up, and then my data is "fixed". If I want to refresh the data on each request, I need to read it inside the view function that handles the request, but I don't understand how. The following is my views.py from django.shortcuts import render from django.http import HttpResponse from django.template import loader import gspread import pandas as pd import datetime from oauth2client.service_account import ServiceAccountCredentials scope = ['https://www.googleapis.com/auth/spreadsheets'] creds = { "type": "service_account", "project_id": "ringed-arcana-338821", "private_key_id": "c1b2438db2651b90b92e06974a08cd40da42c696", "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEugIBADANBgkqhkiG9w0BAQEFAASCBKQwggSgAgEAAoIBAQCdzjDytlclQ+g1\n3jsbmHwXrGtLhVhAV3aPzeuWzIvOfer1qYxgAeIiClWxsV/uF8sz/DHCEtY35ZBX\nW73brqSt34dfwLl2fBbvDUVVLyZZsrDw3MxrDhagbn3VUBJtn04WNCkk6E1HKP1E\no9ugvdj+sCLuT9NOQvMqhWQPP/KGs1NhmUJfmNF2dput6u6N26MHT09y28waxhEr\n73gFZOjD3qhIYHQEUOnXb/U4QmDBmwPks2R1IwBAVJq9tjyOgRaC9Kz7fKHUhMZH\n1OG1KWlb+3LUImqju7/kPV2N9wQO5z5xlMWq+S4kTE0C2wy8OPXycv3Ckz3K1OFL\nbNwjmsKLAgMBAAECggEAK8IqZpNTdPzwnkdigpN1Dad9FTMDtsvKD7RdOLK9rePS\nzI5YY6MCDsho3N4/qKkmauLq9VL93gAlV2QUMJ+sAJ70TgQGKandPiqi6C0r6EGZ\nuSCw+pqsgY5CDG2ovocnQxbxtc9I5ouiN29sjpU2X+F9vjGaeaAtB8R3a5ci7GDL\n6T9YEupA6QkowtpTj0xtUMBRuiMi5a1Oc1ofETMg7mTSsgLbuIUUtfTbDNOpT6ri\nWn1ziTzCOB8wkty8anVUF8je+GfcBKzPLvCpjDkqPW2nUjVXRhCuL4PavsrZrXvd\nxD9evOmUvYRgclhZVo1qU09V87USdAZUlHnXEAEAuQKBgQDXVBl6ePhuW3ZeUBmf\nevstAw5U3TwliNXRuudTsRAoACbqEoHXKUuX+FuyrQIEJQjpPCAbJfsT8Dwn43ze\nsFeyZnEB4CnEZEvQSfj8behWrbe83EMzt4YJP5ZjVqNB2NUx4KAzJVEXIsHc5sxc\nndUwyfyvdllTFmlEgBKBYsWBdQKBgQC7nKVcKUCraLspJtXhnDk93S6d8WpU3nvD\nEt4LZ8EJX/G1hWyZASgY0beDG75+SeDVy/pxoU5jRyFpgxtUYngEGAyfv7SQtsWT\n4WCoOkUqbDoX0TyMDssr1Cqksy8uvtwtcXvDjevLy4e72CXLegrJDMWudDCzpu2g\nG4PjlLKz/wKBgBlbuBxqPqeQceItgLb9XrMwVvG7lCe/c57dafy7L3Hmgq6yO0RB\ngruE7heetEwUqHX/NLC9ylHQyuTPr5byIYHK+qgD5CdSwHLpIz9nGiOLFcZSEj/2\n7vwL1wQf4d4RURosn/EmBeS5nScMryiBFehHAVEQmPhl/UOp6YP/Q885An9oEHuo\nozk72tv195Srj/wwVH+HHGHesYn0qoJ/0Q1CJfXsuhWCySF0ot8n2jvP0SrlbD9+\nx/qzFsFxxUdjhzsLCkv2UF/X5YmyfVEf/zJeVanjjCwJhCsuJIGC2eFSDIwUqN39\nmrswT7T6fOp58zgITQ1ZtxlMjUtBhAGkOtblAoGAXtQvXK1kZ1kXXPdJObHyejml\nv3LXDFd4r6J4es6bIQsjY3ggLDWyiyZ9SzLRIyrejgcU4hVZPyOAiq01gJLXU+/p\nbQsTj9sux6kmJOVhGuFLLNl13JeC8GuMfNteme3M+R1FIAZPXOQ6Z0BkB4SU+ijK\nnsJQT+FQEDXWjZk1FXo=\n-----END PRIVATE KEY-----\n", "client_email": "returnrecord@ringed-arcana-338821.iam.gserviceaccount.com", "client_id": "110831427047173795415", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "token_uri": "https://oauth2.googleapis.com/token", "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/returnrecord%40ringed-arcana-338821.iam.gserviceaccount.com" } client = gspread.service_account_from_dict(creds) def CreateSheet(Return_record): sheet = client.open(Return_record).sheet1 return sheet from sheet2api import Sheet2APIClient sheet = client.open('Return Record 2022') sheet_instance = sheet.get_worksheet(0) mylist … -
How do I resolve this urllib3 issue when trying to get a forked django project up and running?
I have a fork of a django project I am trying to get up and running for my local development environment. When I run my requirements it chokes with ~ this message [Cannot install -r requirements.txt (line 28), urllib3[secure]==1.26.0, urllib3[secure]==1.26.1]... etc. (this error spans ~20 lines). So there are conflicting dependencies it says. I have tried removing the specific version declaration and same issue. And, I have tried running under sudo and same issue. It seems like overall there's a discussion around doing some sort of declaration that specifies less than and greater than versions of a package with this general notion that pip isn't great at sorting this sort of thing out on its own but most of that conversation seems a few years old and I'm unclear on how such a declaration should be properly configured. Is this a common issue others have experienced of late? The project is running on django 3.0.2 and I tried to force an update to django to 4.0.2 in the hopes that the issue centers there but that didn't seem to address it either. Thanks in advance for your help.