Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
ModelViewSet routes and methods
Following is my model view set for user model: class UserViewSet(viewsets.ModelViewSet): queryset = User.objects.all() def get_serializer_class(self): if self.action == 'list': serializer_class = UserSerializer elif self.action == 'update': serializer_class = UserEditSerializer else: serializer_class = UserRegisterSerializer return serializer_class def get_permissions(self): if self.action == 'list': permission_classes = [IsAuthenticated] elif self.action == 'update': permission_classes = [IsAuthenticated, isOwner] else: permission_classes = [] return [permission() for permission in permission_classes] Basically what i want is .create, .update, and .list methods from the model viewset for user Registration, Edit profile and get user list functionalities respectively. This is my urls.py router = SimpleRouter() router.register(r'users', views.UserViewSet, basename='user') urlpatterns = [ # path('register/', views.RegisterUser.as_view(), name='api-register'), path('login/', TokenObtainPairView.as_view(), name='token_obtain_pair'), path('token/refresh/', TokenRefreshView.as_view(), name='token_refresh'), # path('', views.UsersList.as_view(), name='api-home'), # path('users/<pk>/edit/', views.EditProfile.as_view(), name='api-edit'), path('', include(router.urls)), ] Im not sure what is going on because when i send GET request with user edit url api/users/ i can view any users information. Is there a way to avoid this? i want to view all users using api/users only. Not specific ones. -
I want to link tawk.to live chat feature to email
I am building a freelance django website for my client where he want to get orders from the visitors who visit the site, he want to chat with the visitors and communicate with them and throw them the offer, so he want to keep the chat history with the linked email, how can i do that with tawk.to live chat. i only tried the tawk.to live chat widget, i enclosed that in a condition that if the user is logged in then to show up and now i want that when the user will again visit the site he should be able to see his chat history. -
Attach listener to Azure Active Directory Microsoft login for Django
I'm writing an app using Django that uses exclusively MS login to authenticate users. I've followed the same structure as the sample code set up at their Django tutorial. https://github.com/Azure-Samples/ms-identity-python-django-tutorial/tree/main/1-Authentication/sign-in, where it uses some middleware and Django adapters provided by a seemingly undocumented and unused library they've created at https://github.com/Azure-Samples/ms-identity-python-samples-common/. I'm able to grab ID token claims from a request, but what I want to do is attach a listener to login to manipulate or add an entry in a database (regarding user information). I can't figure out a way to hook something to login. For reference, I created and am using a basic AAD tenant, and MS automatically redirects users after authentication to localhost/auth/redirect with some GET parameters like "code", "state", and "session state". -
django admin broken in development mode
I am a newbie in django (not in programming though) and following the w3school tutorials. When running the django admin at 127.0.0.1:8000/admin/ and in development mode, I end up with a layout problem which seems to be related to how the django css files are accessed. I have a clean and new django install. I have googled the problem and all that I have found are posts solving the same problem in production mode (not in development mode) or posts dated more than 10 years. Does anyone understand what is going on and how to fix the problem? -
Can I create a symbolic link inside Azure file share for a file in Azure file share?
I need some understanding and possibility on, how to create a symbolic link for a file present in Azure File share, inside another directory in the same file share. Is it possible? If yes, then please provide an insight on how to do the same using the Azure Python SDK or Azure Portal. PS: I looked into the NTFSAttributes class of Azure Python File share SDK. Is it possible to do it that way? Any guidance on the above would be appreciated. Thank you! -
CommandError: You must set settings.ALLOWED_HOSTS if DEBUG is False. while debug is true
in the settings.py i use environs for my debug and in docker-compose.yml i set it to True my django is 4.2.4 and python 3.11.3 settings.py from pathlib import Path # from django.db.models import Q from environs import Env # # from accounts.models import CustomUser # Build paths inside the project like this: BASE_DIR / 'subdir'. env = Env() env.read_env() BASE_DIR = Path(__file__).resolve().parent.parent # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = env('DJANGO_SECRET_KEY') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = env.bool('DJANGO_DEBUG') ALLOWED_HOSTS = ['*'] docker-compose.yml version: '3.9' services: web: build: . command: python /code/manage.py runserver 0.0.0.0:8000 volumes: - .:/code ports: - 8000:8000 depends_on: - db environment: - 'DJANGO_SECRET_KEY=...' - 'DJANGO_DEBUG=True' db: image: postgres:14 environment: - "POSTGRES_HOST_AUTH_METHOD=trust" but it says CommandError: You must set settings.ALLOWED_HOSTS if DEBUG is False i try asking chat gpt and its help and internet and in manage .py i import a file and in that i add django.setup and settings.configure after this i have this error -
Django model aggregate function returns different result in shell and in request endpoint
Django version: 4.2.4 Python version: 3.10.8 from django.shortcuts import render from django.db.models.aggregates import Max from .models.product import Product def product_page(request): agg = Product.objects.aaggregate(max__price=Max('price')) return render(request, 'product.html', {'max_price': agg['max__price']} I get following error when reading the result from agg : 'coroutine' object is not subscriptable But, when I run the same code in django shell I get the expected result in dict What am I missing here? -
How can I create a Django form out of a Model with an intermediary model? (I.E, a box with many products, as in, 10 products A, 5 products B)
First of all, the specifics of the project I'm working on are essentially the same as the example shown in this question, so I think it's easier to explain what I want to achieve using them. Background from the mentioned question: Think of a Box model that contains products, using an intermediary model, we can store not only multiple products but also different quantities of each product. Here is the code from the answer to the question mentioned above: class Box(models.Model): boxName = models.CharField(max_length=255, blank = False) product_set = models.ManyToManyField(ProductSet) def __str__(self): return self.boxName class ProductSet(models.Model): quantity = models.PositiveIntegerField() product = models.ForeignKey(Product, on_delete = models.PROTECT) class Product(models.Model): productName = models.CharField(max_length=200) productDescription = models.TextField(blank=True) productPrice = models.DecimalField(max_digits=9, decimal_places=0, default=0) class Meta: db_table = 'products' ordering = ['-productName'] def __str__(self): return self.productName This solution solves the model set up for what I want to achieve. In my specific case, the box model is a project model, and the products model is a materials model, essentially I want to store projects, which reference various materials required for said project, so each material will have different quantities. As a quick example: if there's a cake project, the materials can be 5 eggs and 1 … -
Django: update model via task
The code examples mentioned below are (over) simplified I have a users model with a field where all data related to each user from that model is recorded as xml. File -> users.py class Users(models.Model): firstname = models.CharField(max_length=200) dob = models.DateTimeField("date published") unconfirmed = models.BooleanField(blank=True, default=False) xml = models.TextField(blank=True, default="") I created a task in charge of updating that field for all users. At the end of the process, I trigger user.save() and it works fine. This task will be used on a regular basis to run a full update File -> update-users-xml.py Class Command(ParallelCommand): def handle(self, *args, **options): users = Users.objects.filter(unconfirmed__isnull=True) for user in users: # Get all fields user.xml = .... user.save() Now, what I'm trying to achieve is -> if an user is edited/created from the admin, the task is called and the xml column is updated. I edited the save function in the users model to trigger the task: def save(self, *args, **kwargs): async_task(call_command, "update-users-xml", self.id) And, as I anticipated, it wouldn't work because: Can't update because of lock key Maximum recursion depth exceeded Checking what options are available, using signal seems the way to go but I cannot make it work In the users model, … -
Why is 'Go Back' button not working in Django?
I am currently building an image description writing website. Tools/langs I use are html, css, django, and javascript. The problem is, when I click on the 'Go back' button on the html provided below, it doesn't redirect me to the previous mission-acting-writing page (account:write_page_url) but stays at the mission-acting-finish.html. 'Posting' and 'Image' are the models stored in models.py. 'Posting' stores every info user enters when writing one's post, and 'Image' stores individual image files extracted from the image zip file user has provided when writing the post. I've been struggling with this problem for the past 20 hours nonsleep. Please identify the problem in the code. Thank you so much in advance! Here is the code of my function 'end' in views.py: def end(request, posting_id, image_index): posting = get_object_or_404(Posting, id=posting_id) user_detail, created = UserDetail.objects.get_or_create(user=request.user) if request.method == 'POST': action = request.POST.get('action') if action == 'complete': total_reward = request.session.get('total_reward', 0) user_detail.point += total_reward user_detail.save() request.session['total_images'] = 0 request.session['total_reward'] = 0 request.session['image_index'] = 0 request.session['listlength'] = posting.remaining_count return redirect('account:explore') context = { 'total_images': request.session.get('total_images', 0), 'total_reward': request.session.get('total_reward', 0), 'posting_id': posting_id, 'image_index': image_index, } request.session.pop('image_ids', None) return render(request,'mission-acting-finish.html',context)` Here is a section of my mission-acting-finish.html: <main class="main-wrapper"> <header class="section_product-header"> <div class="w-layout-blockcontainer w-container"> <h1 … -
Showing 'str' object has no attribute 'text'
I am trying to build a quiz app, where a user can select an option and the option is saved against its question in a particular quiz. So i tried using the below approach. I created my models.py as below. class Quiz(models.Model): name=models.CharField(max_length=200) topic=models.CharField(max_length=100) number_of_questions=models.IntegerField() difficulty=models.CharField(max_length=100,choices=difficulty_choices) TimeLimit=models.IntegerField(blank=True) def get_questions(self): return self.questions_set.all()[:self.number_of_questions] class Questions(models.Model): text=models.CharField(max_length=200) quiz=models.ForeignKey(Quiz,on_delete=models.CASCADE) correct=models.CharField(max_length=25) def __str__(self): return str(self.text) def get_answers(self): return self.answers_set.all() class Answers(models.Model): text = models.CharField(max_length=200) question = models.ForeignKey(Questions, on_delete=models.CASCADE) def __str__(self): return f"Question: {self.question.text}, Answer: {self.text}" class UserAnswer(models.Model): quiz=models.ForeignKey(Quiz,on_delete=models.CASCADE) user = models.ForeignKey(User, on_delete=models.CASCADE) question = models.ForeignKey(Questions, on_delete=models.CASCADE) answer = models.ForeignKey(Answers, on_delete=models.CASCADE,null=True,blank=True) now the question and eahc of its respective answers is displayed in a form. the options are in the forms of radio select button. I have created that form below. class QuizForm(forms.ModelForm): class Meta: model = Quiz fields = ['text'] exclude = ["text"] # Add other fields as needed selected_answer = forms.ChoiceField( label="Select the correct answer", choices=[], # We'll update choices dynamically widget=forms.RadioSelect ) def __init__(self, *args, **kwargs): super(QuizForm, self).__init__(*args, **kwargs) quiz_instance = kwargs.get('instance') questions = quiz_instance.get_questions() for question in questions: answers = question.get_answers() answer_choices = [(answer.id, answer.text) for answer in answers] # Update the choices of the selected_answer field self.fields['selected_answer'].choices = answer_choices Now in … -
AWS ALB DNS is not reachable
New to AWS. I setup ECS and create a task with ALB. Running python Django application in ECS task on port 8000, and ALB shows healthy on status based on health endpoint. When I try to run curl http://<DNS_ALB>/<healthcheck endpoint> its not able to return any data. ALB shows healthy means that health check endpoint is reachable from ALB to ECS container. There is not specific security, I am using all default VPC and Security group. Default security group has ALL inbound and ALL outbound open. I know I have to change the security and all, but just trying to learn with default if all things works, then will add more security. -
How to edit a models (users) field ''globally'' using fetch or ajax?
So I have this JavaScript file and I want to globally change a field for the current authenticated user? I have a profile model with a level field: class Profile(models.Model): user = models.OneToOneField(User, null=True, on_delete=models.CASCADE) level = models.IntegerField(default=1) And for my url I have added the context and got it to log into the targeted JS file urls.py def game(request): profile = Profile.objects.get(user=request.user) #profile object level = profile.level #level context from the profile return render(request, 'games/game.html', {'level': level}) game.js: const data = document.currentScript.dataset; const level = parseInt(data.level); console.log(level); // BOILER PLATE FETCH // fetch(url, { method: "POST", credentials: "same-origin", headers: { "X-Requested-With": "XMLHttpRequest", "X-CSRFToken": getCookie("csrftoken"), }, body: JSON.stringify({payload: "data to send"}) }) .then(response => response.json()) .then(data => { console.log(data); }); and It console logs the level from that, However I want to know Is it possible to ''globally'' edit the level value using that boilerplate fetch down there? or maybe Ajax? My main issue is that I think I could specifically edit the level for the showProfilePage view (maybe) but I would prefer the level to be permanently updated to the desired number. That way it would retain its updated number anywhere I used its context. I just don't even … -
Django ORM .distinct() seems to return duplicate results
I have an Event model that represents an Event happening. I have another EventShow model which represents a date and time that the event is taking place. Each event can have multiple shows, so I have a ForeignKey from EventShow to Event as follows - class Event(models.Model): name = models.CharField(max_length=32) # ... and more class EventShow(models.Model): event = models.ForeignKey(Event, on_delete=models.CASCADE, related_name='shows') start_date = models.DateTimeField() I want to get a list of events which have at least one show happening in the future, so in my view I'm calling the ORM like this - events = Event.objects.filter(shows__start_date__gt=now()).prefetch_related('shows').distinct().order_by('shows__start_date') However, I still get the same event showing up multiple times if it has multiple shows. How can I fix this? I looked at the SQL that was being generated by this call - SELECT DISTINCT "core_event"."id", "core_event"."name", "core_eventshow"."start_date" FROM "core_event" INNER JOIN "core_eventshow" ON ("core_event"."id" = "core_eventshow"."event_id") WHERE ("core_eventshow"."start_date" > 2023-08-16 02:48:46.063093) ORDER BY "core_eventshow"."start_date" ASC I'm using SQLite for development. -
Gunicorn & Django: Handle timeout
We run a Django REST API behind Gunicorn (on a Kubernetes Cluster in EKS exposed via AWS ALB). The Gunicorn command: gunicorn config.wsgi --timeout 20 (...) When a request takes over 20 seconds to be processed by Django (due to various reasons), gunicorn will timeout by emitting a SigAbt signal and restart the gunicorn worker. However, this causes an issue in tracking the error in various tools such as Datadog or Sentry which are not able to track the error correctly. Instead, we would like to emit an explicit error (customer error) called TimeoutError. After a thorough investigation, we want to find the best way to raise this TimeoutError at Django Level when the request takes 20 seconds to complete. What would be a recommended solution? -
Django slice then filter queryset
I'm trying to use pgvector to find similar products by name, I've built the embedding on the name, now, when I try to use the method that is stated on the docs for pgvector in order to get the products with a certain distance using ALIAS the query never executed, I tried the other method using group_by which worked the get top 10 for example, but in some cases, top 10 might be too far from being similar to the product, That's why I want to order_by then filter based on the distance only for the 100 in order to ensure that I'm getting similar items, The problem with Django is I can't filter after slicing the queryset, I have a workaround which is: Getting the top 100 ordered by distance and then using their id to filter for the next query which will cause more executing time. (More than 100K records) Is there a better way of doing it, thanks. Slice then filter: result = self.get_queryset().order_by(L2Distance('name_embedding', entry_vector))[:100].alias(distance=L2Distance('name_embedding', entry_vector)).filter(distance__lt=threshold) -
Django Custom User model and Authentication
i want to create a user model for three types of user role Student, Teacher and Principal By inheriting AbstractUser in Django how can i do this.? i have seen many projects but the create a single table for authentication of all students, teachers and principal and link it to another model such as StudentProfile, TeacherProfile and PrincipalProfile using onetoone field i want that all student information such as their username, email, password,... to be saved in a single table similarly i want all info for teacher to be save in single table (Not in student table) same for principal Is it possible? If yes how can i perform their authentication -
I am getting AnonymousUser for request.user after loggin out in Django. How can I fix this?
I have a view called LogoutView that is decorated with the @permission_classes([IsAuthenticated]) decorator. When I call the get() method on this view, I am getting AnonymousUser for request.user after logging out. I have tried the following things to fix this, but none of them have worked: I have checked the request.user.is_authenticated attribute to make sure that the user is authenticated before logging them out. I have returned a 401 Unauthorized response if the user is not authenticated. I have called the logout() method to log the user out. from rest_framework.views import APIView from rest_framework.response import Response from rest_framework import status from myapp.models import User from django.contrib.auth import authenticate, login, logout import requests from django.shortcuts import get_object_or_404 from django.http import JsonResponse from rest_framework.decorators import api_view, permission_classes from rest_framework.permissions import IsAuthenticated, AllowAny from .models import ChatRoom, UserChatRoom from myapp.serializers import ChatRoomSerializer, UserSerializer from django.contrib.sessions.models import Session from django.contrib.auth import login, authenticate from rest_framework.response import Response from rest_framework.views import APIView from rest_framework import status import requests from .models import User # Make sure you import your User model correctly from rest_framework.permissions import AllowAny class GoogleLoginView(APIView): permission_classes = [AllowAny] def post(self, request): credential = request.data.get('credential') google_response = requests.get(f'https://www.googleapis.com/oauth2/v3/tokeninfo?id_token={credential}') if google_response.status_code == 200: google_data = … -
How can I access templates from an imported Django application?
I want to pip install a Django application and be able to access its templates when adding it to the "INSTALLED_APPS" section in Django project's "settings.py" file. I followed the tutorial here to build a Django app and export it as an installable package, then installed this package into the virtual environment of another Django project. Everything works fine when I add the app's name in INSTALLED_APPS and when I include the urls of the imported app in the project's urls.py file. However, when I run the lightweight server of the Django project and try to access one of the imported app's page, I get a "django.template.exceptions.TemplateDoesNotExist" error. Why would Django allow to access the urls and views of an imported app, but not its templates or templatetags? When running the server and sending a request to it for a specific web page, I was expecting to get this web page (located in the templates of the imported app) to load on my browser. -
django view function is not executing in asgi mode
I am using django development environment to develope an app while trying to execute view function i am getting raise SynchronousOnlyOperation(message) django.core.exceptions.SynchronousOnlyOperation: You cannot call this from an async context - use a thread or sync_to_async. i have configured the django app using asgi mode and running the daphne via command daphne myproject.asgi:application. there is a signup form in my app where user put his name,company_id,email as username and password. i want to store the username,password in user model and the company_id against that user in userprofile model. signup view is failing to execute the django orm queries and i am unable to store the data as expected. ``` async def signup(request): if request.method == 'POST': form = UserCreationForm(request.POST) if form.is_valid(): user = form.save(commit=False) user.email = user.username user.first_name = request.POST.get('first_name') user.last_name = request.POST.get('last_name') user.save() customer_id = request.POST.get('customer_Id') # Get the customer_id from the form print(customer_id) try: customer = await sync_to_async(Customer.objects.get)(customer_id=customer_id) except Customer.DoesNotExist: return render(request, 'core/signup.html', {'form': form, 'error_message': 'NA'}) userprofile = await sync_to_async(Userprofile.objects.create)(user=user, customer=customer) await sync_to_async(userprofile.save)() await sync_to_async(login)(request, user) # Using sync_to_async for login return redirect('landingpage') else: form = UserCreationForm() return render(request, 'core/signup.html', {'form': form}) ``` -
How can I move data from one model to another with Django/python?
basically i have trhee models where the information of user is already there, but i created a third model called License user, so that i can move the information to that model, how can i do that in an efficient way? Model 1 class License1(models.Model): full_name = models.TextField(blank=False, null=False) email = models.TextField(blank=True, null=True) expire_date = models.DateTimeField(blank=False, null=False) unitcode = models.TextField(blank=True, null=True) wg_version = models.CharField(max_length=10, blank=False, null=False) user_name = models.CharField(max_length=40, blank=False, null=False) description = models.TextField(blank=True, null=True) Model 2 class License2(models.Model): full_name = models.TextField(blank=False, null=False) email = models.TextField(blank=True, null=True) expire_date = models.DateTimeField(blank=False, null=False) unitcode = models.TextField(blank=True, null=True) wg_version = models.CharField(max_length=10, blank=False, null=False) user_name = models.CharField(max_length=40, blank=False, null=False) description = models.TextField(blank=True, null=True) User Model class UserLicense(models.Model): """User information model.""" user_name = models.CharField(max_length=40, blank=False, null=False, unique=True) full_name = models.CharField(max_length=80, blank=False, null=False, unique=True) email = models.TextField(blank=False, null=False) I'm usign db.sqlite3, if anyone can explain the process i would be really grateful -
Running R code in Python using rpy2 - Kernel dying
I want to run a R code in my pythons jupyter notebook, My plan is to run the model with both R code and python combined in Django server to publish the ML model(I myself din't make the model so I dont know anything about it). People who made the ML model have used both python varaibles in R code and R varibles in python code. So it would be better if I have all of the programs in a single django server. Due to which I want to run the R code in my python jupyter notebook as the first step. I came accros rpy2 and tried using rpy2 for this. But whenever I try to import something from rpy2 my kernel just dies I just did "pip install rpy2" as suggested to install rpy2. Do I need to set a path like this to for the import to work, But I dont know where to set the path of R to set to since I dont have R folder in my libs even after I installed rpy2 using pip Optional Quetion: Also on the side note is it possible to do what I am thinking on running the … -
Nautobot celery ERROR/MainProcess] Received unregistered task of type
I'm using nautobot with celery and redis for background tasks but it doesn't seem to work. This is my error: [2023-08-15 18:37:13,227: ERROR/MainProcess] Received unregistered task of type 'nautobot_device_onboarding.worker.onboard_device_worker'. The message has been ignored and discarded. Did you remember to import the module containing this task? Or maybe you're using relative imports? Please see http://docs.celeryq.org/en/latest/internals/protocol.html for more information. The full contents of the message body was: b'[["bcc4229d-f59b-427d-b702-042ff378bfed", {"__nautobot_type__": "nautobot_device_onboarding.utils.credentials.Credentials", "username": "UserAdmin", "password": "Acuat1v3", "secret": "Acuat1v3"}], {}, {"callbacks": null, "errbacks": null, "chain": null, "chord": null}]' (269b) Thw full contents of the message headers: {'lang': 'py', 'task': 'nautobot_device_onboarding.worker.onboard_device_worker', 'id': '3adba9a4-6aee-49ce-bdca-78eafb6c43e1', 'shadow': None, 'eta': None, 'expires': None, 'group': None, 'group_index': None, 'retries': 0, 'timelimit': [None, None], 'root_id': '3adba9a4-6aee-49ce-bdca-78eafb6c43e1', 'parent_id': None, 'argsrepr': "(UUID('bcc4229d-f59b-427d-b702-042ff378bfed'), *Credentials argument hidden*)", 'kwargsrepr': '{}', 'origin': 'gen56@f8decca231bf', 'ignore_result': False} The delivery info for this task is: {'exchange': '', 'routing_key': 'default'} Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/celery/worker/consumer/consumer.py", line 591, in on_task_received strategy = strategies[type_] KeyError: 'nautobot_device_onboarding.worker.onboard_device_worker' This file is the worker.py where the task should be defined with the @nautobot_task, the import works but it doesn't define the function. try: from nautobot.core.celery import nautobot_task CELERY_WORKER = True @nautobot_task def onboard_device_worker(task_id, credentials): """Onboard device with Celery worker.""" return onboard_device(task_id=task_id, credentials=credentials) except ImportError: … -
Microsoft Teams integration for Django self-hosted in AWS
I already spent several hours on Microsoft docs making very little progress for what I believe should be a trivial integration, but apparently it's not. I've a Slack integration (via Slack app, built in Django and hosted on AWS) that works this way: our client installs the app and we receive a single token with the token we can pull all slack workspace accounts once that's done, our app sends 2 types of messages using that same token: a message to a public slack channel a 1-to-1 message to an individual I need to replicate this behaviour for Microsoft Teams. I don't want to use Azure, nor node.js, ideally if I could spin up few endpoints to exchange tokens on Django and some logic to send the messages that would be gold. At this point I will take any wisdom from Teams experts ... Thanks -
AttributeError: module 'projeto_cad_chip' has no attribute 'wsgi'
I have a problem when i'll deploy my Django application. The error return is: error return This is my file path: file path I have too my web.config in wwwroot: web.config I'm using windows server 2008 and python 3.7 wsgi.py: wsgi.py I already check my Handler Mappings and FastCGI Settings, but doesn't found anything wrong, by i know. I trying to deploy a Django application in a local Windows Server, but when open in the port 80 returns me this error: Error occurred while reading WSGI handler: Traceback (most recent call last): File "c:\users\nmcscript\appdata\local\programs\python\python37\lib\site-packages\wfastcgi.py", line 791, in main env, handler = read_wsgi_handler(response.physical_path) File "c:\users\nmcscript\appdata\local\programs\python\python37\lib\site-packages\wfastcgi.py", line 633, in read_wsgi_handler handler = get_wsgi_handler(os.getenv("WSGI_HANDLER")) File "c:\users\nmcscript\appdata\local\programs\python\python37\lib\site-packages\wfastcgi.py", line 603, in get_wsgi_handler handler = getattr(handler, name) AttributeError: module 'projeto_cad_chip' has no attribute 'wsgi' StdOut: StdErr: