Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How to use form data to render a certain view.py function in Django
I am working on this harvardCS50 project where I have to redirect the user to the article page if their search query meets the dictionary key. I have stored the articles as 'text' and headings as 'head in the dictionary. data = { "textone": {"head": "Title one", "text": "This will be text ONE."}, "texttwo": {"head": "Title two", "text": "This will be text TWO."} } I was able to make article links that render the requested data, but I have not been able to do it through the form data. If the user input meets the key in my dictionary, the html should render the data based on that. I have been stuck on it for 2 days, kindly help. <head> <title>{% block title %} {% endblock %}</title> </head> <body> <nav> <form action="" method="GET"> <input type="text" name="q"> <input type="submit"> </form> <ul> {% for key, value in data.items %} <a href="{% url 'wikiApp:entry' key %}"><li> {{ value.head }} </li></a> {% endfor %} </ul> </nav> {% block body %} {% endblock %} </body> Following is my views.py: def intro(request): context={"data": data} return render(request, 'wiki/layout.html', context=context) def title(request, entry): for name in data: if name == entry: return render(request, 'wiki/content.html', { "head": data[name]['head'], "text": … -
I'm Tetando shows some fields in my template plus I come across this error in Forms [closed]
django.core.exceptions.FieldError:Unknown field(s)(produtos) specified for Product e aqui esta o codigo: class SelecaoProdutoForm(forms.ModelForm): class Meta: model = Product fields = ('produtos',) widgets = { 'produtos':forms.CheckboxSelectMultiple } estou querendo mostra os produtos que tenho e junto deles vim um checkbox para mim selecionar -
How to add a Bootstrap modal to edit the item selected?
I'm a beginner Django programmer and I have this project that is about creating timelines in which you can add events, and these events will show up in their timelines along with either a countdown to when it will start, a counter of how long ago it ended, or a countdown of how much time it has until it ends if it's an ongoing event. Here's the project's repository: https://github.com/high-rolls/timely So far I was able to handle timeline creation, edit and deletion, as well as event creation and displaying timelines and events within a timeline. But I started having trouble when trying to allow the user to edit an event on the list, what I wanted to do was display a Bootstrap modal, like the one I already display when adding a new event but for editing one, and I wanted to have only a single edit modal element at the bottom of the page (instead of adding a modal after each event's div). Should I do this with JavaScript to dynamically pass the ID of the selected event and fetch the data of that event to fill up the modal's form? I am also confused whether I should use … -
How to cache a TensorFlow model in Django
In Django, I have this TensorFlow model: model = predict.load_model('path\model.h5') After the model is loaded, I want to keep it in memory such that I can use it multiple times without constantly reloading it. I tried using the cache like this: model = predict.load_model('path\model.h5') cache.set('model', model) when I try to retrieve it by: cache.get('model') I get this error: Unsuccessful TensorSliceReader constructor: Failed to find any matching files for ram://cf101767-7409-47ba-8f98-0921cc47a20a/variables/variables You may be trying to load on a different device from the computational device. Consider setting the experimental_io_device option in tf.saved_model.LoadOptions to the io_device such as '/job:localhost'. Is there a different approach to keeping the model loaded ? -
Poetry and Django project 'HTTPResponse' object has no attribute 'strict' [closed]
Education case: on Windows 10 system in VSCode after successful poetry init I have problem with this error, while adding dependencies I know I need later on. Any ideas to fix? -
Can IIS read an exe file of my dynamic web application?
If I convert my django code into an executable file and host it on IIS, will IIS be able to read and execute the code and keep running my dynamic web application (which is accessible to the internet) If yes, I want to know how to achieve such scenario? Please help me out Thanks in advance I want IIS to be able to read obfuscated code or code which is converted to executable file. I want step by step process to achieve this -
Django simple_history query : type object has no attribute 'history'
First of all sorry for my English, I will try my best. I've 2 model; Post and PostComment. And I want show history of comments or history of post on the frontend. When I try to this I'm getting the error : type object has no attribute 'history' Here is my models: models. py from django.db import modelsfrom autoslug import AutoSlugField from simple_history.models import HistoricalRecords from ckeditor.fields import RichTextField class Post(models.Model): Date = ... EditedDate = ... Published = models.BooleanField(default=False) Sender = models.ForeignKey(User, on_delete=models.CASCADE) Title = models.CharField(max_length=200) Text = RichTextField() def __str__(self): return self.Title class PostComment(models.Model): Date = ... EditedDate = ... Comment_Sender = models.ForeignKey(User, on_delete=models.CASCADE, related_name='yorum') Post = models.ForeignKey(Post, on_delete=models.CASCADE, related_name='yorumlar') Comment = models.TextField() Published = models.BooleanField(default=False) History = HistoricalRecords() # new line def __str__(self): return self.YorumGonderen.pers_fullName def save(self, *args, **kwargs): if self.Published == False: self._change_reason = 'Comment is not Approved' else: self._change_reason = 'Comment is Approved' return super().save(*args, **kwargs) and my admin.py from simple_history.admin import SimpleHistoryAdminclass CommentHistoryAdmin(SimpleHistoryAdmin): list_display = ['CommentSender','Comment','Post','Published', 'EditedDate','id'] history_list_display = ['status']search_fields = ['CommentSender'] admin.site.register(Post, CommentHistoryAdmin) I can get all the history records I want but I need to show those records on the page Here is what I am try: def viewPostDetail(request, Slug): Post = … -
Django - OGP Image url preview works inconsistently
I've been struggling with this issue for the past few days now and I still can't find the root cause of it so here it goes: I have a Django blog for which I would like to be able to share links in social media apps such as Whatsapp, Telegram and Signal and I would like these links to have previews containing images of the blog post that the user is sharing. Following the OGP standard I added these meta tags to my page: <meta property="og:image:url" content="{% block meta_img_url_preview %}{% endblock %}"/> <meta property="og:image" content="{% block meta_img_preview %}{% endblock %}"/> <meta property="og:image:secure_url" content="{% block meta_img_secure_preview %}{% endblock %}"/> <meta property="og:image:width" content="1200"/> <meta property="og:image:height" content="630"/> <meta property="og:type" content="article"/> <meta property="og:locale" content="ro_RO"/> After setting up those meta tags, it seems that sharing links via the Whatsapp Web app or the Signal desktop app the image preview shows up just fine. However when using the mobile app and sharing links, only the title and description show up and the image is not being displayed. After checking my server's logs I can see that the requests for the image preview are served just fine with a status of 200: Example of request made using … -
Python django manytomanyfield не получается получить категории
views.py enter image description here models.py enter image description here html enter image description here сайн enter image description here Такая вот тема: я создал две модели ArticlesCategory и Articles, где они связанный полем ManyToManyField. По идее я должен был в файле views передавать все объекты Articles, в html пройтись по нему циклом (что уже работает) а также извлекать список категорий, что приписаны статьям и выводить их через запятую после TAG. Но у меня не выходит. Кто поможет -
"Definition of service not found" error when using pg_service.conf file with Django and PostgreSQL
I'm trying to use a pg_service.conf file to manage database connections in my Django application, but I'm running into an error when trying to connect to the database using the named service. Here's what my DATABASES setting in Django looks like: python DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'OPTIONS': { 'service': 'my_service' } } } And here's what my pg_service.conf file looks like (located at /etc/postgresql-common/pg_service.conf): ini [my_service] host=localhost port=5432 user=my_user password=my_password dbname=my_database However, when I try to run my Django application, I get the following error: psycopg2.OperationalError: service file "/etc/postgresql-common/pg_service.conf" not found The above exception was the direct cause of the following exception: django.db.utils.OperationalError: definition of service "my_service" not found I've checked that the pg_service.conf file exists in the correct location and has the correct permissions, and I've also verified that the service name in my DATABASES setting matches the service name in pg_service.conf. What else could be causing this error? Any help would be greatly appreciated! What I've tried: Verified that the pg_service.conf file exists in /etc/postgresql-common/ and has the correct permissions (owned by postgres user with 0640 permissions). Verified that the service name in my DATABASES setting matches the service name in pg_service.conf. Restarted my Django … -
What is the difference between data and instance in serializer?
When should we use the 'data' instead of 'instance'? serializer = ModelSerializer(data=queryset) serializer = ModelSerializer(instance=queryset) Possibly, this is a beginner question, but I have not found a worthy resource to fully understand serializers. I appreciate it if you describe how to use a ModelSerializer in action. -
How do I render a htmx response using typing effect in Django just like ChatGPT does?
I'm building a book summarizer app as a personal project with Django and I make API requests to OpenAI. The user enters the book name and author and gets the summary of the book. I'm using htmx for the form submission to avoid page refresh. I'm rendering the summary in a container/textbox. I want to implement a loader effect as soon as the user clicks on the "Submit" button and when the response is ready, it should be rendered with a typing effect and the container should also increase as the texts being rendered increase by line. Everything works but the texts don't get rendered using typing effect as I want and also the loader effect starts loading as soon as I open the page not when the user clicks on the submit button. I guess my problem is in the Javascript code. Thanks in advance! Here are my codes: Views.py from django.shortcuts import render import os, openai, json from django.http import JsonResponse, HttpResponse openai.api_key = os.get(OPENAI_API_KEY) # Create your views here. def index(request): result = None if request.method == 'POST': book_name = request.POST.get('book_name') author = request.POST.get('author') prompt = f'Write a summary of the book titled: {book_name} written by {author}. … -
Macbook M2 ImportError: dlopen(_mysql.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_mysql_affected_rows'
I am setting up local workspace for my Django project with MySQL on a Macbook AIR with M2 chip. All config are migrated from my old Macbook Pro with core i7 using OSX Migration Assistant. I am having problem trying to run server on my local, i.e. python manage.py runserver. The err msg is: File "/Users/.../.venv/lib/python3.10/site-packages/django/db/backends/mysql/base.py", line 15, in <module> import MySQLdb as Database File "/Users/.../.venv/lib/python3.10/site-packages/MySQLdb/__init__.py", line 24, in <module> version_info, _mysql.version_info, _mysql.__file__ NameError: name '_mysql' is not defined MySQL server is set up on my local and works fine. I am able to use mysql to connect to my local MySQL server, i.e. mysql -u root -p mysqlclient is installed, the version is 2.1.1 While importing MySQLdb directly using python console, it seems python is having difficulty using dlopen to open the "c compiled" (not sure how this is called exactly) file, or it opened but there was error? Error as: Python 3.10.6 (v3.10.6:9c7b4bd164, Aug 1 2022, 17:13:48) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import MySQLdb Traceback (most recent call last): File "/Users/.../.venv/lib/python3.10/site-packages/MySQLdb/__init__.py", line 18, in <module> from . import _mysql ImportError: dlopen(/Users/.../.venv/lib/python3.10/site-packages/MySQLdb/_mysql.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace … -
How to download tensorflow models in a nginx docker gunicorn django webapp?
I have an nginx docker gunicorn django web app that requires some models to be downloaded from tensorflow, but, as people may see, the current configuration does not allow enough time for it to be downloaded. My current gunicorn file (may not be a problem, because it should give time enough, but somehow it doesn't): bind = '0.0.0.0:8000' workers = 60 timeout = 3600 module = 'production.wsgi' chdir = '/app' forwarded_allow_ips = '*' proxy_allow_ips = '*' In the development stage, prior to this production stage, there was no problem in waiting a first long download to have this files locally. Now in production, the container gives me this error. Downloading (…)lve/main/config.json: 100%|██████████| 571/571 [00:00<00:00, 2.67MB/s] Downloading model.safetensors: 4%|▍ | 52.4M/1.34G [00:20<08:25, 2.56MB/s] [2023-07-16 05:45:06 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:7) site.com.br_1 | [2023-07-16 02:45:06 -0300] [7] [INFO] Worker exiting (pid: 7) Downloading model.safetensors: 4%|▍ | 52.4M/1.34G [00:21<09:02, 2.38MB/s] site.com.br_1 | [2023-07-16 05:45:07 +0000] [138] [INFO] Booting worker with pid: 138 What is the correct approach? I think I need to force the download, probably thru the Dockerfile file ahead, but i cannot grasp how to do it, so how to correctly download this files and, to be more precise, from … -
i want to fetch product by catefory
enter image description here I want to display products according to their category, but I encounter a problem that I could not solve I don't know where the problem is, although I tried to solve it, but to no avail ++++++++++++++++++++++++++++++++++++++++++++++ url from django.contrib import admin from django.urls import path from . import views urlpatterns = [ path('admin/', admin.site.urls), path('home/', views.home, name="home"), path('collaction', views.collactions, name="collactions"), path('collaction/<str:slug>/', views.collectionsview, name="collectionsview"), ] views from django.shortcuts import render from .models import * # Create your views here. def home(request): return render(request, 'store/index.html') def collactions(request): Categorys = Category.objects.filter(status=0) context = { 'Categorys':Categorys} return render(request, 'store/layout/collaction.html', context) def collectionsview(request, slug): if(Category.objects.filter(slug=slug, status=0)): products = product.objects.filter(category__slug=slug) category_name = Category.objects.filter(slug=slug).first() context = {'products':products, 'category_name':category_name} return render(request, "store/products/index.html", context) else: return redirect('collections') html collaction {% extends 'store/layout/main.html' %} {% block content %} <h1>collaction</h1> <div class="row"> {% for item in Categorys %} <div class="col-md-4"> <div class="card"> <a href="{url 'collectionsview' item.slug}"> <div class="card-body"> <div class="category-image"> <img src="{{item.image.url}}"/> </div> <h4>{{ item.name }}</h4> </div> </a> </div> </div> {% endfor %} </div> -
cannot access local variable 'messages' where it is not associated with a value
views.py error cannot access local variable 'messages' where it is not associated with a value cannot access local variable 'messages' where it is not associated with a value cannot access local variable 'messages' where it is not associated with a value -
Creating a draft in Gmail from Django admin action with Google OAuth
I'm trying to create a Django admin action that will create a draft email in my Gmail account, addressed to selected contacts. I'm getting stuck with the Google OAuth flow. admin.py: ... DEBUG = os.getenv('DEBUG', 'False') == 'True' if DEBUG: os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1' SCOPES = ['https://www.googleapis.com/auth/gmail.compose'] def email_contacts(modeladmin, request, queryset): flow = Flow.from_client_secrets_file( 'contacts/client_secret.json', scopes=SCOPES) flow.redirect_uri = "http://localhost:8000/callback" authorization_url, state = flow.authorization_url( access_type='offline', include_granted_scopes='true') return HttpResponseRedirect(authorization_url) def auth_callback(request): code = request.GET.get('code') flow = Flow.from_client_secrets_file( 'contacts/client_secret.json', scopes=SCOPES) flow.redirect_uri = "http://localhost:8000" flow.fetch_token(code=code) creds = flow.credentials send_email(creds) def send_email(creds): message_body = "Test content" message = MIMEMultipart() message['to'] = 'test.address@example.com' message.attach(MIMEText(message_body, "plain")) try: service = build('gmail', 'v1', credentials=creds) message = {'message': {'raw': base64.urlsafe_b64encode(message.as_bytes()).decode()}} service.users().drafts().create(userId='me', body=message).execute() except HttpError as err: print(err) ... class ContactAdmin(admin.ModelAdmin): actions = [emails_contacts] (Just trying to draft a test email so far; not yet trying to populate the email with data from the queryset) urls.py: ... from contacts.admin import auth_callback urlpatterns = [ path('callback/', auth_callback, name='oauth_callback'), path('admin/', admin.site.urls), ... client_secret.json: {"web":{"client_id":"....apps.googleusercontent.com","project_id":"...","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","...":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"...","redirect_uris":["http://localhost:8000/callback","http://localhost:8000/callback/","http://localhost/callback","http://localhost/callback/","http://localhost:8000/","http://localhost:8000","http://localhost","http://localhost/"]}} (Listing lots of redirect_uris to be safe) The error: CustomOAuth2Error at /callback/ (redirect_uri_mismatch) Bad Request Request Method: GET Request URL: http://localhost:8000/callback/?state=...&code=...&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgmail.compose Django Version: 4.2.1 Exception Type: CustomOAuth2Error Exception Value: (redirect_uri_mismatch) Bad Request Exception Location: /home/me/.local/share/virtualenvs/contacts/lib/python3.9/site-packages/oauthlib/oauth2/rfc6749/errors.py, line 400, in raise_from_error Raised … -
Mixins in django.?
Django’s built-in class-based views provide a lot of functionality, but some of it you may want to use separately. For instance, you may want to write a view that renders a template to make the HTTP response, but you can’t use TemplateView; perhaps you need to render a template only on POST, with GET doing something else entirely. While you could use TemplateResponse directly, this will likely result in duplicate code. For this reason, Django also provides a number of mixins that provide more discrete functionality. Template rendering, for instance, is encapsulated in the TemplateResponseMixin. The Django reference documentation contains class AuthorDetailView(DetailView): model = Author def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context["form"] = AuthorInterestForm() return context class AuthorInterestFormView(SingleObjectMixin, FormView): template_name = "books/author_detail.html" form_class = AuthorInterestForm model = Author def post(self, request, *args, **kwargs): if not request.user.is_authenticated: return HttpResponseForbidden() self.object = self.get_object() return super().post(request, *args, **kwargs) def get_success_url(self): return reverse("author-detail", kwargs={"pk": self.object.pk}) class AuthorView(View): def get(self, request, *args, **kwargs): view = AuthorDetailView.as_view() return view(request, *args, **kwargs) def post(self, request, *args, **kwargs): view = AuthorInterestFormView.as_view() return view(request, *args, **kwargs) Please someone explian me,with simple example... -
file size limitation for upload in django
I want to limit the size of uploaded files on the site and I want not to work with forms and handle myself with html and input tags. What should I do to get the file from the input type file? I made request.POST but it did not access the file. Can you guide me? def register(request): file = request.POST.get('image').size validate_file_size(file) def validate_file_size (value): filesize = value.size print(filesize) if filesize > 512*1024 : raise ValidationError("error ") else : return value -
Django vs Flask
Django vs Flask I've created an AI language model in the form of an API. Now I want to integrate this model into your website. Which do you think is better, Django or Flask? Now, I'm not sure what the difference is between Django and Flask, and I'd like to ask you which one you would recommend if I were building a website. -
AssertionError: Expected a `Response`, `HttpResponse` or `HttpStreamingResponse` to be returned from the view, but received a `<class 'coroutine'>`
I want to async view with my django rest framework api_view but I am getting the above error even if I had awaited my response. Here is my view @api_view(['POST']) @permission_classes([AllowAny]) @authentication_classes([]) async def login(request): email = request.data.get('email') if email is None or email == '': return Response(data={'success': False, 'message': 'Invalid credentials'}) user = await sync_to_async(User.get_by_email)(email=email) if user is not None and user.is_active and user.check_password(raw_password=request.data.get('password')): serializer = UserSerializer(user) # TODO async tokens_map = await sync_to_async(AuthUtils.generate_token)(request=request, user=user) asyncio.run(create_preference(request, user=user)) return Response({'success': True, 'user': serializer.data, 'tokens': tokens_map}) return Response(data={'success': False, 'message': 'Invalid login credentials'}, status=status.HTTP_404_NOT_FOUND) Is there any way to use async views with django in an efficient way? What about asyncio, like if I wrap all of my blocking methods with asyncio.run, what will be the impact with the performance? Can asgi based servers will take the full advantage of asyncio? -
How to approve PayPal subscription automatically without approval URL
I am facing an issue with integrating PayPal subscriptions into my project. Currently, the integration process involves: adding PayPal as a payment method on my website using PayPal checkout. Then, on the 'Plans & Pricing' page, I select a subscription plan, which creates a new PayPal subscription using the PayPal REST API in Backend. From there, the API generates an approval URL, which redirects me to the PayPal Approval Page where I must input my PayPal credentials to approve the subscription. However, what I desire in my project is: the ability to subscribe to a plan without being redirected to the Approval Page and having to input my PayPal credentials again. *Freelancer.com, for example, has this functionality where after verifying the payment method, there is no need to input PayPal credentials again when subscribing to a plan. * I would greatly appreciate any help in achieving this functionality. Thank you, Chris -
How Do I Retrieve Data From a Form after A Button is Clicked using Django
I have searched for the solution for hours, and all of the solutions that I have found do not work (I'm probably doing something wrong). I want to be able to retrieve data entered by the user in the "email" and "password" fields of my login page. However, I can't find a working solution. Help?! # the login form <form> <label>First Name</label> <input id="first-name-input" type="text" placeholder=""/> <label>Last Name</label> <input id="last-name-input" type="text" placeholder=""/> <label>Email</label> <input id="email-input" type="email" placeholder=""/> <label>Password</label> <input id="password-input" type="password" placeholder=""/> <label>Confirm Password</label> <input type="password" placeholder=""/> <input type="button" value="Submit"/> <closeform></closeform></form> -
Django Project: Trying to understand why my Django project is showing the error Understanding TypeError Invalid path type list:
I am trying to understand why my Django project is saying that it cannot understand my paths. According the instructions of the book django for beginners I need to run the python manage.py runserver command to load the website but it stops me. It shows the following when I get the error: Error Message (.venv) andrewstribling@Andrews-MBP pages % python manage.py runserver Watching for file changes with StatReloader Performing system checks... Traceback (most recent call last): File "/Users/andrewstribling/Desktop/code/pages/manage.py", line 22, in <module> main() File "/Users/andrewstribling/Desktop/code/pages/manage.py", line 18, in main execute_from_command_line(sys.argv) File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/core/management/__init__.py", line 436, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/core/management/base.py", line 412, in run_from_argv self.execute(*args, **cmd_options) File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/core/management/commands/runserver.py", line 74, in execute super().execute(*args, **options) File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/core/management/base.py", line 458, in execute output = self.handle(*args, **options) File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/core/management/commands/runserver.py", line 111, in handle self.run(**options) File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/core/management/commands/runserver.py", line 118, in run autoreload.run_with_reloader(self.inner_run, **options) File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/utils/autoreload.py", line 671, in run_with_reloader start_django(reloader, main_func, *args, **kwargs) File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/utils/autoreload.py", line 660, in start_django reloader.run(django_main_thread) File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/utils/autoreload.py", line 343, in run autoreload_started.send(sender=self) File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/dispatch/dispatcher.py", line 176, in send return [ File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/dispatch/dispatcher.py", line 177, in <listcomp> (receiver, receiver(signal=self, sender=sender, **named)) File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/template/autoreload.py", line 43, in watch_for_template_changes for directory in get_template_directories(): File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/template/autoreload.py", line 20, … -
'pwa' in django brings a error and its not found yet its installed as one of the requirements in the pip list.. It keeps on bringing an error
File "/Users/mac/Desktop/rental-house-management-system-main/myenv/lib/python3.11/site-packages/Django/apps/config.py", line 228, in create import_module(entry) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/import lib/init.py", line 126, in import_module ModuleNotFoundErrorthe error: No module named 'pwa' was expecting the server to run and execute my project