Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Runtime error while using post methord in forms submision
Title: Getting Runtime Error (Append Slash) on Submit Button Click Description: I'm encountering a runtime error when I click the submit button on my form. The error mentions something about appending a slash. I've tried to understand it, but I'm stuck. Can someone please help me figure out what's causing this error and how to resolve it? I'm using python with django for my project. Additional Information: [Provide relevant code snippets if possible] [Any error messages received] <form action="register" method="POST" onsubmit="register"> {% csrf_token %} <h3>my information</h3> <h4>Contact us today, and get reply with in 24 hours!</h4> <style> fieldset { border: medium none !important; text-emphasis-color:black; margin: 0 0 10px; min-width: 100%; padding: 0; width: 100%; } </style> <fieldset> <input placeholder="Your name" type="text" tabindex="1" style="background-color:black;" required autofocus> </fieldset><br> <fieldset> <input placeholder="Your Email Address" type="email" tabindex="2" style="background-color:black;" required> </fieldset><br> <fieldset> <input placeholder="Your Phone Number" type="tel" tabindex="3" style="background-color:black;" required> </fieldset><br> <fieldset> <label for="account">Choose a account:</label> <select name="account" id="name"> <option value="netflix">netflix</option> <option value="amazone prime">amazone</option> <option value="disney plus hotstar">hotstar</option> </select> <style> #nname { padding: 5px; color: #f7f7f8; font-size: 12px; background: black; appearance: none; } </style> </fieldset><br> <fieldset> <textarea placeholder="Type your Message Here...." tabindex="5" style="background-color:black;" required></textarea> </fieldset><br> <fieldset> <button name="submit" type="submit" id="contact-submit" style="background-color:rgb(23, 12, 12);" data-submit="...Sending" value="submit">Submit</button> … -
Django . password and phone number is not storing in admin page
[enter image description here](https://i.stack.imgur.com/xuuor.png)enter image description here I was making a project and the data of customers are not being added to the admin page. the First name last name and email shoes up after the signup but the phone number and password dont show up. How do i fix it? -
chrome not saving httponly refresh token on incognito mode django react jwt auth
I am building an app using django and react. Im using JWT auth, and access refresh tokens for auth. ive deployed it in heroku, connected my domain, now it works on regular browsing but on incognito it doesnt work, meaning when i log in the user, in incognito mode the refresh token doesnt get saved, so it cannot reauthenticate. ive read that its good to send the refresh token through httponly, so thats what im doing, but it deosnt get saved in the incognito but it does on regular. I tried to understand it using chatgpt but it says there isnt much i can do then swithcing to another auth method, but there should be a way, if httponly refresh token is the secure way of doing it there should be a way to make it work. here is my website:http://www.chronocraftusa.com/ git:https://github.com/ashgharibyan/ChronoCraft settings.py """ Django settings for backend project. Generated by 'django-admin startproject' using Django 4.2.1. For more information on this file, see https://docs.djangoproject.com/en/4.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/4.2/ref/settings/ """ from pathlib import Path from datetime import timedelta from environs import Env import os env = Env() env.read_env() # Build paths inside the project … -
how to store and manage the access_token and refresh_token for Oauth2 (React JS)?
I have an API Rest created in Django and Django Rest Framework. I implemented the Oauth2 protocol using the OAuth Toolkit library. The backend is built and working. I have questions about how to maintain and manage tokens in the front-end made in React. The access_token expires every 10 days, so I need to make a request to renew the access_token using refresh_token. The big issue is that when creating the React build, even using environment variables, with each token renewal, I will have to generate the build again. Is there any way to do this differently, without having to generate a new build every time the token is renewed? -
How to makemigrations django 2.2.9 multiple DB
So I am working in a legacy project with a Django 2.2.9 and here we have 3 DBs, nobody migrated on two additional databases ever, and now its time to do it, but nobody knows how to do it on django 2.2.9 on a database that is not default... I tried writing migration manually and running it - didnt help python manage.py makemigrations No changes detected Any help? -
Array of dictionaries in Django models and forms
I'm working on a static routes plugin for the Netbox project. For my static route object, I need a property, qualified_next_hops, which is a list of dictionary objects. Each item in the list field would have a few keys: next_hop_address, next_hop_interface, admin_distance, route_metric, route_tag. In my model and forms, what field can I use for this list of dictionaries? I've used ArrayField elsewhere, but I don't know how to use a dictionary object as the base field. Any advice? -
Object of type (serializer name) is not JSON serializable
I have a legacy system and a new one for classes (the kind you teach). In this part of the project I am trying to bring items from the old into the new but I keep running into "Object of type ThingOldClassSerializer is not JSON serializable" and I have yet to figure out why. There are no NULLs in the data. Some code: models.py class OldTemp(models.Model): legacy_user_id = models.PositiveIntegerField() legacy_title = models.CharField(max_length=250,) legacy_material_limit = models.PositiveIntegerField() legacy_handout_limit = models.PositiveIntegerField() legacy_handout_fee = models.FloatField() legacy_material_fee = models.FloatField() legacy_duration = models.FloatField() legacy_culture = models.CharField(max_length=250) legacy_topic = models.CharField(max_length=250) legacy_adult_only = models.BooleanField() legacy_heat_source = models.BooleanField() legacy_year = models.PositiveIntegerField() legacy_private_camp = models.BooleanField() legacy_active = models.BooleanField(default=True) instructor = models.CharField(default='') def __str__(self): return self.legacy_title serializers.py class ThingOldClassSerializer(serializers.ModelSerializer): class Meta: model = OldTemp exclude = ['legacy_user_id', 'legacy_active'] views.py class ThingOldToNewView(generics.CreateAPIView): queryset = OldTemp.objects.all serializer_class = ThingOldClassSerializer def get(self, request, pk, curr_old): oldclass = get_object_or_404(OldTemp, pk=pk) serializer = ThingOldClassSerializer(oldclass) return Response({'serializer': serializer, 'thingcurrentclass': oldclass}) def post(self, request, pk, curr_old): oldclass = get_object_or_404(OldTemp, pk=pk) serializer = ThingOldClassSerializer(oldclass, data=request.data) if serializer.is_valid(): self.check_object_permissions(request, oldclass) serializer.save(legacy_active=False) return redirect('home_page') return Response({'serializer': serializer, 'thingcurrentclass': oldclass}) The item displays just fine, but when I click a button to move the it into the new system (POST action) I … -
Permutation feature importance with multi-class classification problem
I am wondering if we can do Permutation feature importance for multi-class classification problem? from sklearn.inspection import permutation_importance metrics = ['balanced_accuracy', 'recall'] pfi_scores = {} for metric in metrics: print('Computing permutation importance with {0}...'.format(metric)) pfi_scores[metric] = permutation_importance(xgb, Xtst, ytst, scoring=metric, n_repeats=30, random_state=7) Cell In[5], line 10 8 for metric in metrics: 9 print('Computing permutation importance with {0}...'.format(metric)) ---> 10 pfi_scores[metric] = permutation_importance(xgb, Xtst, ytst, scoring=metric, n_repeats=30, random_state=7) File c:\ProgramData\anaconda_envs\dash2\lib\site-packages\sklearn\utils\_param_validation.py:214, in validate_params.<locals>.decorator.<locals>.wrapper(*args, **kwargs) 208 try: 209 with config_context( 210 skip_parameter_validation=( 211 prefer_skip_nested_validation or global_skip_validation 212 ) 213 ): --> 214 return func(*args, **kwargs) 215 except InvalidParameterError as e: 216 # When the function is just a wrapper around an estimator, we allow 217 # the function to delegate validation to the estimator, but we replace 218 # the name of the estimator by the name of the function in the error 219 # message to avoid confusion. 220 msg = re.sub( 221 r"parameter of \w+ must be", 222 f"parameter of {func.__qualname__} must be", 223 str(e), 224 ) ... (...) 1528 UserWarning, 1529 ) ValueError: Target is multiclass but average='binary'. Please choose another average setting, one of [None, 'micro', 'macro', 'weighted']. Then I tried to use average='weighted', then I still got an … -
Recursion error in django model when setting constraints
Im trying to create an app to keep track of matches however I keep getting an error when trying to create add to my match model. I want to make sure that team 1 and team 2 dont have the same players, is this the correct way to do so? How do i resolve my error? team1_names = set([player.playerName for player in self.team1.all()]) ^^^^^^^^^^ … Local vars Variable Value self Error in formatting: RecursionError: maximum recursion depth exceeded while calling a Python object class player(models.Model): playerName = models.CharField(max_length = 255,primary_key = True) club = models.ForeignKey(club,on_delete=models.CASCADE) inGameFlag = models.BooleanField(default = False) elo = models.IntegerField(default = 1200) class session(models.Model): sessionID = models.AutoField(primary_key=True) club = models.ForeignKey(club,on_delete=models.CASCADE) date = models.DateField(default = get_today) players = models.ManyToManyField(player) def __str__(self): return str(self.date) class Meta: constraints = [ models.UniqueConstraint(fields=['sessionID', 'club'], name='unique_session') ] class match(models.Model): matchID = models.AutoField(primary_key=True) session = models.ForeignKey(session,on_delete=models.CASCADE) team1 = models.ManyToManyField(player, related_name='team1') team2 = models.ManyToManyField(player, related_name='team2') score = models.CharField(max_length = 255, default = '00-00') completed = models.BooleanField(default=False) def clean(self): team1_names = set([player.playerName for player in self.team1.all()]) team2_names = set([player.playerName for player in self.team2.all()]) common_players = team1_names.intersection(team2_names) if common_players: raise ValidationError({'team1': 'Players cannot be in both team1 and team2.'}) if self.team1.count() > 2 or self.team2.count() > 2: … -
django-admin: redirecting after object save
I have an "edit" button in the detailed view for one of my Django models. This button sends the user to the admin panel. Example for the "project" model: /admin/<app_name>/project/3108/change/ Once the user finishes making changes and hits "Save", they are redirected back to the main admin panel. Is it possible, instead, to send them back to the detailed view in the app? -
ValueError at /pharmcare/patients-create/: "needs to have a value for field "id" before this many-to-many relationship can be used."
Please help me with the Django app I am creating called pharmcare on the issue I am having. I have been stuck on this value-error for 2 days now, and I had researched how to sort it out when using the ManyToMany relationship including reading the Django docs. Still, I ended up getting None as total payment in the patients http://127.0.0.1:8000/pharmcare/patient-list/ which is kind of weird in my second solution, and I believe I am missing something on my second solution. Please, I do want the total to be saved dynamically once the pharmacist has added the discount price and if there is no discount which I set to null and blank=True, I would want the previous total to be saved as well on pharmaceutical_care_plan table of my PostgreSQL. Here is my model: class PharmaceuticalCarePlan(models.Model): class Meta: ordering = ['id'] user = models.ForeignKey('songs.User', on_delete=models.CASCADE) pharmacist = models.ForeignKey( "Pharmacist", on_delete=models.SET_NULL, null=True, blank=True) organization = models.ForeignKey( 'leads.UserProfile', on_delete=models.CASCADE) patients = models.ManyToManyField('Patient') patient_unique_code = models.CharField( max_length=20, null=True, blank=True) total_payment = models.PositiveBigIntegerField(null=True, blank=True) discount = models\ .PositiveBigIntegerField(null=True, blank=True, help_text="discount given to patient,\ perhaps due to his/her consistent loyalty strictly authorized by \ management (if any).") # other codes slug = models.SlugField(null=True, blank=True) date_created = … -
Django project not working on my friends device
I created a a small website using django. I can host it locally and can interact all the buttons like sign up page and login page. but when my friend tried to run project then they can able to start django server but can't able to interact with sign up page and login page! He can see the server syntax on html page like {% csrf_token %}. Please help!!!!!!!!!!!!!!!! -
Best Practice for Django Mixins?
I'm working on a Django project and creating a custom mixin, specifically a MessagesMixin for handling success and error messages. I'm using it with CreateView and UpdateView. I'm wondering about the best practice regarding the mixin's dependency on the view it is mixed into??. I have created a two version of MessagesMixin, which one is the correct answer ??? Version 1: class MessagesMixin: success_message = None fail_message = None fail_redirect_url = None def form_valid(self, form): response = super().form_valid(form) if self.success_message: messages.success(self.request, self.success_message.format(self.object)) return response def form_invalid(self, form): super().form_invalid(form) if self.success_message: messages.error(self.request, self.fail_message.format(self.object)) return redirect(self.fail_redirect_url) Version 2: class MessagesMixin(ModelFormMixin, View): success_message = None fail_message = None fail_redirect_url = None def form_valid(self, form): response = super().form_valid(form) if self.success_message: messages.success(self.request, self.success_message.format(self.object)) return response def form_invalid(self, form): super().form_invalid(form) if self.success_message: messages.error(self.request, self.fail_message.format(self.object)) return redirect(self.fail_redirect_url) -
Why no junction table for ForeignKey in Django Model? How prefetch_related works under the hood
I am trying to understand the difference between select_related and prefetch_related in Django. More specifically, how do both of them work under the hood. My understanding of select_related is clear but I am confused about prefetch_related. Here is my sample Django model. class Club(models.Model): name = models.CharField(max_length=100) class Teacher(models.Model): name = models.CharField(max_length=100) class Student(models.Model): name = models.CharField(max_length=100) teachers = models.ManyToManyField('Teacher') club = models.ForeignKey('Club', null=True, blank=True, on_delete=models.SET_NULL) When I see the db.sqlite3 through an extension, I can see following tables - club, student, teacher, and student_teachers which is the junction table that stores the relationship. Why is there no club_teachers? I understand there is no need for a junction table for OneToOne but for 1:N/ForeignKey, how do we access them? I guess it has something to do with this part in official documentation. prefetch_related, on the other hand, does a separate lookup for each relationship, and does the ‘joining’ in Python How does prefetch_related help with the N+1 problem if it does a "separate lookup for each relationship, and does the ‘joining’ in Python"? I understand the difference between select_related and prefetch_related is that select_related is for single-valued relationships but then how does the reverse relationship for Club work? -
Django Foreign Key To Any Subclass of Abstract Model
I have an abstract Django model with two concrete implementations. E.g. class Animal(models.Model): name = models.CharField("name", max_length=100) class Meta: abstract = True class Dog(Animal): ... class Cat(Animal): ... And then I want to create a generic foreign key that points to a Dog or a Cat. From the documentation about GenericForeignKeys I know that I can do something like from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.db import models class Appointment(models.Model): content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE) object_id = models.PositiveIntegerField() patient = GenericForeignKey("content_type", "object_id") But I have to do this for every model that can point to a Dog or a Cat. It doesn't enforce that the foreign key actual points to an Animal. Is there a way to set up my Animal model such that in the Appointment model I can just do class Apointment(models.Model): patient = GenericRelation(Animal) -
Django : Login/authentication function is not working
im trying to write a login function code in my django app everything seems to be fine but still everytime i try to login to an account in that application it seems to return me back to the the same page here is my views.py code def admin(request): if request.user.is_authenticated: return redirect("/admin_home") else: if request.method == "POST": uname = request.POST.get("uname") pas = request.POST.get("psw") use = authenticate(username=uname , password=pas) login(request,use) return render(request,"admin_login.html") Html Code here <!DOCTYPE html> {% load static %} <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> {% for message in messages %} <div style="background-color:lime;position:fixed;top:0%; width:90%; height:5%; font-size:25px; font-family:sans-serif; left:5%; border-radius:11px; text-align:center; line-height:2;"><b>{{ message }}</b></div> {%endfor%} <h2 style="margin-left:20%;">Login</h2> <link rel="stylesheet" href="{% static 'login.css' %}"> <div style="height:70%; width:60%; margin-left:20%;"> <form method="POST"> <div class="imgcontainer"> <img src="https://cdn-icons-png.flaticon.com/512/21/21104.png" alt="Avatar" class="avatar" style="height:30%; width:30%;"> </div> <div class="container"> <label for="uname"><b>Username</b></label> <input type="text" placeholder="Enter Username" name="uname" id="uname" required> {% csrf_token %} <label for="psw"><b>Password</b></label> <input type="password" placeholder="Enter Password" name="psw" id="psw" required> <button type="submit">Login</button> </div> <div class="container" style="background-color:#f1f1f1"> <button type="button" class="cancelbtn">Cancel</button> </div> </form> </div> </body> </html> ive tried every possible thing in my knowledge and im stuck on this part so please help me -
Python LightGBM error: joblib.externals.loky.process_executor.TerminatedWorkerError {SIGSEGV(-11)} [duplicate]
I am utilizing Microsoft’s lightgbm (lgbm) library. Whilst my lgbm script is VERY similar to my scripts for xgboost and random forests (which both work fine), I appear to consistently get the following error on both the Mac Book Pro and MacStudios (with M1 chips) when using lgbm: joblib.externals.loky.process_executor.TerminatedWorkerError: A worker process managed by the executor was unexpectedly terminated. This could be caused by a segmentation fault while calling the function or by an excessive memory usage causing the Operating System to kill the worker. The exit codes of the workers are {SIGSEGV(-11)} Relevant Code: _train_x, _val_x, _train_y, _val_y = train_test_split(_train_x, _train_y, test_size = 0.2) lgbm_model = LGBMClassifier(bagging_fraction = 0.75, bagging_freq = 5, random_state=42, verbose=-1, force_col_wise=True) kfoldcv = StratifiedKFold(n_splits=3, shuffle=True, random_state=7) lgbm_random_search = RandomizedSearchCV(estimator = lgbm_model, param_distributions = self._param_dict, n_iter = self.num_searches, cv = kfoldcv, verbose=2, random_state=42, n_jobs=-1) lgbm_random_search.fit(_train_x, _train_y) self._CrossVal_largest_accscore = lgbm_random_search.best_score_ lgbm_model = LGBMClassifier(n_jobs=-1, verbose=-1, force_col_wise=True, bagging_fraction = 0.75, bagging_freq = 5, **lgbm_random_search.best_params_) lgbm_model.fit(_train_x, _train_y, callbacks=[early_stopping(50), log_evaluation(50)], eval_set=[(_val_x,_val_y)]) NB when I simply remove the clause njobs=-1 my program just terminates when running the line: lgbm_random_search.fit(_train_x, _train_y) Environment: System Software Overview: System Version: macOS 14.0 (23A344) Kernel Version: Darwin 23.0.0 Boot Volume: Macintosh HDBoot Mode: Normal Secure Virtual Memory: … -
Method Not Allowed (POST) I'm stuck
I have been trying to fix this for hours. I can't seem to see what's causing the error :( views.py @login_required def create_brand(request): template_name = "poc/brand_add.html" context = {} context["form"] = forms.BrandForm() if request.method == "POST": form = forms.BrandForm(request.POST) if form.is_valid(): print(form.cleaned_data) form.save() return render(request, template_name, context=context) else: return render(request, template_name, context=context) forms.py class BrandForm(forms.ModelForm): class Meta: model = models.Brand fields = ('brand_id' , 'brand_name', 'company') models.py class Brand(models.Model): brand_id = models.AutoField(primary_key=True) brand_name = models.CharField(max_length=255) company = models.ForeignKey('Company', models.DO_NOTHING) date_created = models.DateTimeField(auto_now_add=True, blank=True) class Meta: managed = False db_table = 'brand' def __str__(self): return f"{self.brand_name}" template: brand_add.html {% extends 'base.html' %} <body> {% block content %} <div class="container"> <h1>Create new Brand</h1> <form action="{% url 'poc:list_brand' %}" method="post"> {% csrf_token %} {{form.as_p}} <input type="submit" value="Create"> </form> </div> {% endblock %} </body> urls.py path('brand/', views.BrandListView.as_view(), name='list_brand'), path('brand_add/', views.create_brand, name='create_brand'), path('brand/<int:pk>', views.BrandDetailView.as_view(), name='detail_brand'), Still can't add a 'brand' Is it because of using function based views instead of CBV? -
instantiate a django form in readonly mode in a view function
I have a django 4 form having some widgets for the user to select some values: from django import forms from .app.model import MyModel from bootstrap_datepicker_plus.widgets import DatePickerInput class MyForm(forms.ModelForm): # stuff class Meta: model = MyModel fields = [ "user_id", "created_at", "some_other_field", ] widgets = { "user_id": forms.NumberInput(), "created_at": DatePickerInput(), "some_other_field": forms.NumberInput(), } I instantiate that form in several functions the views.py file: my_form_instance = forms.MyForm( data=data, user=request.user, ) One function "create_or_edit" for creating a new or editing an existing record. And another function to delete a record. In the deletion function (used by a specific endpoint /form/12/delete), I want to display the form but in read-only mode. How could I achieve that? I know I can add attrs={'readonly': True,} in each of the widget to make it non-editable. But this will also apply to the form instances used by the create_or_edit function in my views. I'm using django 4.2 on Ubuntu 22.04 with Python 3.10.6. -
Best Practice for Django Mixins - Self-Contained or Dependent on View?
I'm working on a Django project and creating a custom mixin, specifically a MessagesMixin for handling success and error messages. I'm using it with CreateView and UpdateView. I'm wondering about the best practice regarding the mixin's dependency on the view it is mixed into. I want to understand whether it is more common and considered best practice for mixins to be self-contained with all dependencies or if it's acceptable for a mixin to depend on the view it is mixed into. I have created a two version of MessagesMixin, both work fine, but I'm uncertain about the best practice regarding its dependency on the view. Version 1: class MessagesMixin: success_message = None fail_message = None fail_redirect_url = None def form_valid(self, form): response = super().form_valid(form) if self.success_message: messages.success(self.request, self.success_message.format(self.object)) return response def form_invalid(self, form): super().form_invalid(form) if self.success_message: messages.error(self.request, self.fail_message.format(self.object)) return redirect(self.fail_redirect_url) Version 2: class MessagesMixin(ModelFormMixin, View): success_message = None fail_message = None fail_redirect_url = None def form_valid(self, form): response = super().form_valid(form) if self.success_message: messages.success(self.request, self.success_message.format(self.object)) return response def form_invalid(self, form): super().form_invalid(form) if self.success_message: messages.error(self.request, self.fail_message.format(self.object)) return redirect(self.fail_redirect_url) -
Sync_to_async wrapper best practice question
So I'm building a python async program using Djang framework and I'm having some doubts about if I am correctly using the sync_to_async and database_sync_to_async functions. I'm applying them to all my I/O bound operations such as databases accesses and external API requests. However I noticed that I was also applying that wrapper to some sync functions that I do not know if they require it. some examples include functions where I only manipulate small lists and dictionaries and where I convert in memory objects to JSON to return as response. Examples: class Store(object): def __init__(self, employee, promotional): self.employee = employee self.promotional = promotional def to_dict(self): return {"employee": self.employee, "promotional": self.promotional} def store_emplyee_rate(employee_details, currency): if CURRENCIES[currency]["valid"]: employee_details["conversion_rate"] = "test" def convert_situation( value, currency, conversion_rate=None, use_decimal=False, use_int_64=False ): if value == 0: if use_decimal: return Decimal(value) return value elif CURRENCIES[currency]["valid"]: value = Decimal(value) / 100 if conversion_rate: value = value * Decimal(conversion_rate) return value else: if use_decimal: return Decimal(value) / pow(10, CURRENCIES[currency]["decimals"]) if use_int_64: return value * 1000 return value Do I need to wrap this functions with sync_to_async calls or is that context switching uneccessary in these and similar cases? My app runs through ASGI and Uvicorn. -
Why doesn't pycharm accept my validations in Django code?
When i type in my training project in model.py validators,pycharm after the activation shows this: TypeError: 'type' object is not iterable What is the reason of this? My code in models.py: from django.db import models from django.urls import reverse from django.utils.text import slugify from django.core.validators import MaxValueValidator,MinValueValidator # Create your models here. class Movie(models.Model): EUR = 'EUR' USD = 'USD' RUB = 'RUB' CURRENCY_CHOICES = [ (EUR, 'Euro'), (USD, 'Dollar'), (RUB, 'Rubles'), ] name= models.CharField(max_length=40) ratings=models.IntegerField(validators=[MinValueValidator(1), MaxValueValidator(100)]) year=models.IntegerField(null=True,blank=True) currency=models.CharField(max_length=3, choices=CURRENCY_CHOICES,default=RUB) budget=models.IntegerField(default=1000000,blank=True,validators=[MinValueValidator(1)]) slug=models.SlugField(default='', null=False) def save(self,*args,**kwargs): self.slug=slugify(self.name) super(Movie,self).save(*args,**kwargs) def get_url(self): return reverse('movie-detail', args=[self.slug]) def __str__(self): return f'{self.name} - {self.ratings}%' -
How to build a good-looking portfolio website for yourself best with a less html and css using Python django development?
I need to build a port folio website for my first programming language of python using django environment. Good css even i don't know anything but can also be able to edit some sections where i can change anything. Also want to describe my in a best way to land a job or any fresher interview for python development. also be able to migrate for promoting yourself to a any start up company where they will teach you. I know this could be a little difficult but if we are approaching a right way. Kindly suggest me up and do contribute for us so we can able to find a passion in ourselves. it should also have a navation bar and also details about yourself. with your pictorial background so recruiter can also be able to find a perfect picture in that website and while scroll down colour intensity will also desc from it to the bottom of the whole page. also put details of contact as well tell a story of whole academic life. -
404 using wfastcgi to deploy Django app to IIS 10 on Windows Server 2022
I'm deploying a Django app to IIS 10 on Windows Server 2022. I followed this tutorial for it but I'm getting a 404: https://blog.nonstopio.com/deploy-django-application-on-windows-iis-server-93aee2864c41 Here are my screenshots: -
I am facing this error while i was trying to create my views in django i was trying to create a view called home_page
I am using django 5.0 I added the httprequest in my views.py and returned it but it is giving the following errors i have my init.py file and my server was running perfectly before this[[[(https://i.stack.imgur.com/qf5MM.png)](https://i.stack.imgur.com/YQT0k.png)](https://i.stack.imgur.com/0A345.png)] i was expecting for the page to return the http request