Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
django-allauth signup() missing 1 required positional argument: 'model'
As you can imagine i'm new to django. İ tried to use allauth package for signup-in issues. After studying bunch of basic tutorials etc. the basic configuration started to function just fine but i needed custom signup process for my project. So i started to dig more and implemented this topic to my code -- [1]: django-allauth: custom user generates IntegrityError at /accounts/signup/ (custom fields are nulled or lost) After the implementation i started to debug various issues caused by django-version difference but eventually i ve got the following error: TypeError at /accounts/signup/ signup() missing 1 required positional argument: 'model' Request Method: POST Request URL: http://localhost:8000/accounts/signup/ Django Version: 3.2.3 Exception Type: TypeError Exception Value: signup() missing 1 required positional argument: 'model' the topics and pastebin links that i've found are not working anymore. thats why i'm stucked with this error. i think im missing something basic but cant figure it out. Here are my model-form-settings and adapters below: models.py from djmoney.models.fields import MoneyField from django.db import models from django.contrib.auth.models import User from django_countries.fields import CountryField from phonenumber_field.modelfields import PhoneNumberField from django.dispatch import receiver from django.db.models.signals import post_save from django.contrib.auth.models import AbstractUser from django.conf import settings class CtrackUser(AbstractUser): date_of_birth = models.DateField(help_text='YYYY-MM-DD … -
curl: (3) Port number ended with '.'
curl: (3) Port number ended with '.' (env) (base) 192:core prashantsagar$ curl -X POST -d "client_id=CTrbHZNtiS2VrbN9iVaVzPRHU13sHdHZd6bbMoKZclient_secret=YQ0gtl7UXAJZK596bPetswWYYYyiG8Zq1zZcTytvs1f0t3cPMX2d0fTJbgNVq9eZ3qOvDTL0MekujuHvkaeiFn5ALjQ7yBKO3XYJWzXKQ4vqA4670krGm6KXf6wc2F33grant_type=password&username=sagar@fmail.com.com&password=sagar" http://localhost:127.0.0.1:8000/auth/token/ curl: (3) Port number ended with '.' -
I am trying to deploy django application using heroku but getting error?
Build is successdul and it is producing application error, i have set up host name and debug=False as suggested but it is still causing error in opening the browser window, i am new to heroku so please suggest what needs to be done to make it work my settings.py """ Django settings for djangoTut project. Generated by 'django-admin startproject' using Django 3.2.4. For more information on this file, see https://docs.djangoproject.com/en/3.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.2/ref/settings/ """ from pathlib import Path import os # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent print(BASE_DIR) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = mysecretkey # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = ['djangoblog-project.herokuapp.com'] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'blog.apps.BlogConfig', 'users.apps.UsersConfig', 'crispy_forms', ] 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', ] ROOT_URLCONF = 'djangoTut.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'djangoTut.wsgi.application' … -
How to make simple python UDP socket server?
I am trying to make a python socket server based on UDP. The point is that we need to receive data from the Java client socket server and the python UDP protocol socket server must throw JSON data to React in the front. I have the level of knowledge to make a simple UDP chat server, so I'm worried a lot now. I am currently reading the django channels official documentation. Does django-channeles provide easy configuration to use UDP protocol as well? -
how do I solve Django TypeError - post() got multiple values for argument 'slug'?
I am creating a e commerce website and I am a beginner in Django and Python My cart name is "Kart" The cart is an cart object in session. It store the cart in session. it Works in main shop page but it is not working in product_details(productView) The views.py logic adds the product in cart but it dose not redirect to product page as a post request. I have to click on address bar and reload again to get back to product page. Product details page Views.py class productView(View): def post(request, slug ): product = request.POST.get('product') remove = request.POST.get('remove') kart = request.session.get('kart') if kart: quantity = kart.get(product) if quantity: if remove: if quantity <=1: kart.pop(product) else: kart[product] = quantity-1 else: kart[product] = quantity+1 else: kart[product] = 1 else: kart = {} kart[product] = 1 request.session['kart'] = kart return redirect('product-view', slug=slug) def get(self,request, slug): product = Product.objects.filter(product_slug=slug) return render(request, 'T_kart/ProductView.html', {'product': product[0]}) urls.py from django.contrib import admin from django.urls import path from . import views app_name = 'T_kart' urlpatterns = [ path('', views.index.as_view(), name="T-kart-Home"), path('product-<slug:slug>/', views.productView.as_view(), name="product-view"), path('kart/', views.kart.as_view(), name="kart"), path('checkout/', views.checkout, name="checkout"), path('search/', views.search, name="search"), path('wishlist/', views.wishlist, name="wishlist"), ] Template (html) <div style="display: flex; align-items: center; justify-content: center; margin-top: … -
django text box in user get value of quantity automatic mutipication and insert the database
your quantity in user insert the value and database insert the all pen rate=3 basic quantity =90 and user quantity get value of user and automatic multiply by rate and save into database -
Attritube error when importing local python file
I would like some help in figuring out an issue. The code below is attempting to import a file called game_getter.py to access it's all_games dictionary variable. from django.db import models from catolog import game_getter # Create your models here. class Game(models.Model): url_clue = ["//images.igdb.com"] for game in game_getter.all_games: title = game_getter.all_games[game][0] if url_clue in game_getter.all_games[game][1]: cover_art = game_getter.all_games[game] else: pass if game_getter.all_games[game][2] == None: pass else: storyline = game_getter.all_games[game][2] if game_getter.all_games[game][3] == None: pass else: storyline = game_getter.all_games[game][3] genre_pac = game_getter.all_games[game][4] def __str__(self): return self.title class UserSearch(): user_input = str At the bottom of this next session I used a return on the dictionary object all_games. I've even tried making it a global variable and the computer still won't see it. # Create a search def search_query(user_input, exp_time): # Generate token if needed generate_token(exp_time) #establish client_id for wrapper client_id = "not my client_id" wrapper = IGDBWrapper(client_id, token) # Query the API based on a search term. query = wrapper.api_request( 'games', # Requesting the name, storyline, genre name, and cover art url where the user input is the search tearm f'fields name, storyline, genres.slug, cover.url; offset 0; where name="{user_input}"*; sort first_release_date; limit: 100;', # Also sorted by release date with … -
need help to render graph inside web page on date range picker in Djanog
i created form in my html form to pick date range using daterangepicker and passed same to views.py in DJANGO. After clicking submit button (POST), views.py function being called thru url.py and got the DB query result and reruns JsonResponse. now issue is my web page is geeting redirected to new web page. but i want to stay in same webpage and get the graph to display. HTML page is <div> <form action="/reportgeneration" method="POST"> {% csrf_token %} <input type="text" name="daterange" /> <input type="submit" value="Submit"> </form> </div> <div id="EnegryChart"></div> <script> var start = moment().subtract(29, 'days'); var end = moment(); $(function () { $('input[name="daterange"]').daterangepicker({ opens: 'left', showDropdowns: true, "drops": "auto", startDate: start, endDate: end, locale: { format: 'YYYY-MM-DD' }, ranges: { 'Today': [moment(), moment()], 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')], 'Last 7 Days': [moment().subtract(6, 'days'), moment()], 'Last 30 Days': [moment().subtract(29, 'days'), moment()], 'This Month': [moment().startOf('month'), moment().endOf('month')], 'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')] } }, function (start, end, label) { console.log("A new date selection was made: " + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD')); }); }); </script> and my URL.py is urlpatterns = [ ........ path('reportgeneration', views.reportgeneration), ..... and views.py is def reportgeneration(request): ........ if request.method == "POST": date_range = request.POST.get('daterange').split(" - ") … -
URL to work with parameter and without parameter in Django
I am using Django for my project, and I want to render thank-you page. But it should be with or without parameters. urls.py urlpatterns = [ .... path(r'thank-you?t=<type>?n=<name>', thank_you_view, name='thank-you'), .... ] it is working fine for urls like :http://127.0.0.1:8080/thank-you%3Ft=teacher%3Fn=Ajay,%20Gaikwad Template make use of parameters. but not working for url without parameters like : http://127.0.0.1:8080/thank-you Default template will be rendered here. also I tried some regex path(r'thank-you(?t=<type>?n=<name>|'')', thank_you_view, name='thank-you'), But it not working. views.py def thank_you_view(request, *args, **kwargs): context = {kwargs['type']: kwargs['name']} return render(request, "light/thank-you.html", context=context) -
Django and BeautifulSoup timeout error while scraping
I have a scraper inside my views.py which gets movie and actor data and downloads their pictures from IMDB and inserts them into the Database. Occasionally when I try to scrape some movies(especially ones with higher quality images) I run into nginx timeout error. I've tried to get a log from my code and I found out that as soon as my script gets to the point where it should download high-quality images it crashes and gives me the timeout error. I've tried setting different timeouts for my soup(ranging from 10 to 30) like below but it didn't seem to work: image_url = soup.find('img', class_='ipc-image').get('src') img_obj = requests.get(image_url, headers=headers, timeout=20) img = Image.open(BytesIO(img_obj.content)) img_title = to_url(title) img.save('media/' + img_title + '.webp') I also tried combining it with time.sleep(10) but still I would get the same error. My script works fine for almost 50% of movies but gives me a timeout error for the rest. What else can I do to prevent this from happening? Thanks in advance for your help. -
Problem with django social login allauth : redirects to http://127.0.0.1:8000/accounts/social/signup/# if email exists
I am creating a blog app using django. Now when someone manually registers an account with a particular email and then go back to the login page and try to login using google allauth, it redirects to http://127.0.0.1:8000/accounts/social/signup/# What can I do to connect both the accounts? Using process='connect in the href does not help as it always takes me to that page -
I have passed __all__ in fields of meta class and still i am getting back only one field. suggest a better way to fix it I want all the field there
I have included the serializer as well as the views.py, I am new so it might be possible that i made a very silly mistake here, which I am not able to figure out, please review this code and make me understand how to resolve this issue. serializer.py class ServiceSerializer(serializers.RelatedField): def to_representation(self, value): return value.name class Meta: model = Service fields = ('name') class SaloonSerializer(serializers.Serializer): services = ServiceSerializer(read_only = True, many=True) class Meta: model = Saloon fields = ( 'name', 'services' ) Here in the field of SaloonSerializers I have tried multiple things like only name field but still if get just one output which i have attache at the end of this post. views.py @api_view(['GET']) def saloon_list(request): if request.method=="GET": saloons = Saloon.objects.all() serializer = SaloonSerializer(saloons, many=True) return Response(serializer.data) output: [ { "services": [ "Cutting", "Shaving", "Eye Brow", "Waxing", "Facial massage" ] }, { "services": [ "Cutting", "Shaving", "Facial massage" ] } ] -
I am trying to get the social authentication working wirh DRF
I am trying to use custom user model with dj_rest_auth. here is the repo Problem one: The dj_rest_auth return the reponse as { "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjIzNTY5MzM2LCJqdGkiOiI3YTk1ZjJhM2Y2ZTE0ZmVlOWQzMjEwMDZkMmJiZDk5MSIsInVzZXJfaWQiOjZ9.4yjIBxXhe5grxCe18huamgj1qP44A-zOkUHxZ61wXao", "refresh_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTYyMzU2OTMzNiwianRpIjoiODFlYzdkNjVjZjQzNDI4NjlhYjYzODI4MWUxNDQ4MjUiLCJ1c2VyX2lkIjo2fQ.1p3_Vw8OYoa64B93wHiEEiyKH3oT8M-3FGrivZmvWaA", "user": { "pk": 6, "email": "test@gmail.com" } } But I want to return all the necessary fields as the user object. How can I get that. Problem two: I can register the user by using the path('api/auth/registration/', include('dj_rest_auth.registration.urls')), but I can't login with same credentials using path('api/auth/', include('dj_rest_auth.urls')), It gives me that { "non_field_errors": [ "Unable to log in with provided credentials." ] } *** Please also suggest me should I use dj_rest_auth or should I use other library to make it working with custom user model. -
Wagtail - one "profile" page per user
I am creating website, where center of everything will be creating profile. Profile has lot of properties (imagine dating site for example), rich text and images. I was thinking of creating page type for this purpose (maybe ProfilePage), containing all information of the user. Any user will be able to register and then create it's own profile. I have lot of experience with django, no experience with wagtail and I am wondering, if there's easy way to hook it all up so that it's all nice and user friendly through wagtail admin interface? Another approach I though of was to put most of things into custom User model and then edit those properties directly through admin, but this still doesn't solve some rich content (profile can contain rich text and images). Or does it? -
How to get Count of objects by aggregate within Queryset class
i want to get object that is Maximum length/count of ManyToMany Field class Member(models.Model): pass class Chatroom(models.Model): ... members = models.ManyToMany(Member) ... chatRoom = Chatroom.objects.aggregate(Max('members')) ### {'members__max':15} this code does not return an object like:class <QuerySet [object]> but i want to take an object to do something so i did do this room = ChatRoom.objects.aggregate(max_value=Max('members')).get(members__count=max_value) its got an Error : it says there is no __count look up.. could you help me please... -
How to send data to a page in django
<form method="POST"> <select name="sample"> <option>.....</option> </select> </form> Python file def reqData(request): # overhere i want the data selected by the user, and then will iterate that data through my DB to fetch the desired results The web page is going to run on a GET request, but the data that is needed is coming from a POST request, so how to get the data from the select tag. -
Django Heroku error H10 application error .how to solve?
logs 2021-06-12T07:26:16.610575+00:00 heroku[web.1]: State changed from crashed to starting 2021-06-12T07:26:23.217764+00:00 heroku[web.1]: Starting process with command `: gunicorn taskmate.wsgi` 2021-06-12T07:26:26.603659+00:00 heroku[web.1]: Process exited with status 0 2021-06-12T07:26:26.691415+00:00 heroku[web.1]: State changed from starting to crashed 2021-06-12T07:37:24.490756+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=taskmatealex.herokuapp.com request_id=693beacc-8d74-4bc4-afd4-0341b11ea822 fwd="103.70.154.90" dyno= connect= service= status=503 bytes= protocol=https 2021-06-12T07:37:24.916908+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=taskmatealex.herokuapp.com request_id=b83555ff-8575-4642-beba-4b52872555a7 fwd="103.70.154.90" dyno= connect= service= status=503 bytes= protocol=https 2021-06-12T07:38:01.712652+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=taskmatealex.herokuapp.com request_id=5cbe9cee-1f30-4aab-b9ae-591b058c81df fwd="103.70.154.90" dyno= connect= service= status=503 bytes= protocol=https 2021-06-12T07:38:02.265077+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=taskmatealex.herokuapp.com request_id=95a0862c-b752-458d-a1ce-b6a1a2ce0fcd fwd="103.70.154.90" dyno= connect= service= status=503 bytes= protocol=https 2021-06-12T07:38:27.498712+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=taskmatealex.herokuapp.com request_id=ea75b5a5-ef4e-4733-82e0-6dcd08832269 fwd="103.70.154.90" dyno= connect= service= status=503 bytes= protocol=https 2021-06-12T07:38:27.995906+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=taskmatealex.herokuapp.com request_id=798e9b00-ccc8-493d-99b8-eb1fcfb5385a fwd="103.70.154.90" dyno= connect= service= status=503 bytes= protocol=https 2021-06-12T07:40:28.897745+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=taskmatealex.herokuapp.com request_id=0cc3cc67-c96a-46d7-a896-51f8dade44c1 fwd="103.70.154.90" dyno= connect= service= status=503 bytes= protocol=https 2021-06-12T07:40:29.333000+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=taskmatealex.herokuapp.com request_id=f1a671b0-32fe-4c7c-95ed-a4846370315d fwd="103.70.154.90" dyno= connect= service= status=503 bytes= protocol=https my Procfile web: gunicorn taskmate.wsgi wsgi.py file import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'taskmate.settings') application = get_wsgi_application() I did install gunicorn in my virtual env and I have it in … -
Trying to implement Admin model validation
I am a beginner and trying to implement bid system in Django. I want it to work on both Django admin page and and template, therefore I created modelform and modeladmin in Admins.py. models.py: from django.contrib.auth.models import AbstractUser from django.db import models class User(AbstractUser): pass class category(models.Model): category = models.CharField(max_length=50, default='SOME STRING') def __str__(self): return f"{self.category}" class bid(models.Model): listing = models.ForeignKey('listing', on_delete=models.CASCADE) user = models.ForeignKey(User, null=True, on_delete=models.CASCADE) bid = models.DecimalField(max_digits=6, null=True, decimal_places=2) def __str__(self): return f"{self.user}, {self.listing} {self.bid}" class listing(models.Model): user = models.ForeignKey(User, null=True, on_delete=models.CASCADE) Title = models.CharField(max_length=50) Description = models.CharField(max_length=300) Price = models.DecimalField(max_digits=6, null=True, decimal_places=2) category = models.ForeignKey(category, on_delete=models.CASCADE, related_name="categories") def __str__(self): return f"{self.Title}" admin.py from django.contrib import admin from .models import User, listing, category, bid from django.core.exceptions import ValidationError from django import forms admin.site.register(User) admin.site.register(listing) admin.site.register(category) class bidForm(forms.ModelForm): class Meta: model=bid fields = ['user', 'listing', 'bid'] def clean(self): start_price = self.cleaned_data.get('listing.Price') userbid = self.cleaned_data.get('bid') if userbid <= start_price: raise ValidationError('Please place a bid higher than starting price') return self.cleaned_data class bidAdmin(admin.ModelAdmin): form = bidForm list_display = ('user', 'listing', 'bid') admin.site.register(bid, bidAdmin) It returns the following error: '<=' not supported between instances of 'decimal.Decimal' and 'NoneType'. Also I want to compare instances of previous and current bid on a … -
Django - ModuleNotFoundError: No module named 'alluth'
I encountered an error while trying to make migration. I reinstalled the app yet i still saw the same error. Here is my setting file: INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', # 3rd Party 'rest_framework', 'rest_framework.authtoken', 'allauth', 'allauth.account', 'alluth.socialaccount', 'rest_auth', 'rest_auth.registration', # Local 'posts.apps.PostsConfig', ] # Peculiar to django-allauth app EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' SITE_ID = 1 This is the error am getting when i run python manage.py migrate: ModuleNotFoundError: No module named 'alluth' -
Password Reset Confirm arguments
I am new to django reverse('password_reset_confirm',args=(uid64,token)), I got error in uid64 and token not defined . how to get those value from mail content -
Where is django.contrib.auth.User defined in Django source code
In Django official guide, it reads: Inside this django.contrib.auth model, there is a User class, who has following attributes (username, password, email, first_name, last_name). When I check the source code in github, I did not find this definition in django.contrib.auth. I can only see class AbstractBaseUser(models.Model): in django/contrib/auth/base_user.py on this link, and class User(AbstractUser): in django/contrib/auth/models.py in this webpage. Q1: what does class models.User mean in above official document, it means User is a class under models.py ? Q2: if above is right, then where User class get attributes such as username, email etc? -
AttributeError when trying to created nested serializer in Django REST Framework
I have two models of sets, and cards. Theses models have one to many relationship where there are many cards in a single set. These model are join by a foreign key - each card has set_id which is equal to the id of the set. These IDs are UUID. I am trying to create a serializer using Django REST Framework where I return the details of the set, as well as including all the cards that are part of the set. error Got AttributeError when attempting to get a value for field `cards` on serializer `SetSerializers`. The serializer field might be named incorrectly and not match any attribute or key on the `Set` instance. Original exception text was: 'Set' object has no attribute 'cards'. serializers.py class CardSerializers(serializers.ModelSerializer): class Meta: model = Card fields = ['id', 'number', 'name', 'set_id'] class SetSerializers(serializers.ModelSerializer): cards = CardSerializers() class Meta: model = Set fields = ['id', 'code', 'name', 'releaseDate','cards'] models.py class Set(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) ... objects = models.Manager() def __str__(self): return self.name class Card(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) ... set = models.ForeignKey(Set, on_delete=models.CASCADE, related_name='Cards', related_query_name='Cards') objects = models.Manager() def __str__(self): return self.name views.py class SetsIndividualData(ListAPIView): serializer_class = SetSerializers def get_queryset(self): … -
Update records in a table from views.py with Django
so basically, I wanted to know how I can change the value of a single field in Django from views.py itself without needing to use forms.py I want to do something like this... def driver_dashboard_trip_completed(request, tripId): trip = Trip.objects.filter(pk=tripId) if trip.exists(): if trip.first().user.id == request.user.id: if trip.first().status == "ACTIVE": trip.first().status = "COMPLETED" else: messages.warning(request, "Invalid access (401 - UNAUTHORIZED)") else: messages.warning(request, 'Invalid Trip details') return redirect('driver_dashboard_rides') But doesn't seem like it works, so is there anything that I am missing out?? This is my models.py... STATUS = [ ('UPCOMING', 'Upcoming'), ('ACTIVE', 'Active'), ('COMPLETED', 'Completed') ] class Trip (models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE, null=True) departure = models.CharField(max_length=200) arrival = models.CharField(max_length=200) date = models.DateField(validators=[inthe_future]) time = models.TimeField(default=datetime.now().time()) vacant_seats = models.PositiveIntegerField() vehicle_used = models.ForeignKey(Vehicle, on_delete=models.PROTECT) price_per_person = models.IntegerField() status = models.CharField(choices=STATUS, default='UPCOMING', max_length=10) Any help is greatly appreciated thanks! -
Django | Should my Project Make Requests to my Own API?
I have been working on a project for a while. The project consists in a Django API and a Django website that process and shows the data from that API, everything is in the same Django project. I lack of experience running projects in production, so I can't figure out: At what point should I move the API to a separate server or Django project. If it is okey to make requests to the API (which is open to users) from the Django website itself (from the backend of the site). The Django website works on top of the API, so I don't know if I should make request to the API just as a regular user (taking into account that this will increase the requests the server has to handle) or if I should use the code used for the API (thus having the same data but without calling the API endpoints). What do you think is more suitable?* PS: I'm not sure if Stackoverflow is the correct forum for this question, but I think I need perspective from more experienced users. Thanks in advance. -
ContextualVersionConflict Error with PyJWT on installing djangorestframework-simplejwt
I have a digital ocean django instance and after I installed 'djangorestframework-simplejwt' , I am getting Contextual Version Conflict with following error message (PyJWT 1.7.1 (/usr/lib/python3/dist-packages), Requirement.parse('pyjwt<3,>=2'), {'djangorestframework-simplejwt'}) I have upgraded PyJwt to 2+ version and have also removed existing python3-jwt from the instance but with no success. Not sure how and where this 1.7 version is coming from. I have also upgraded the django version to 3+