Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
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 -
Postgres Django data disappearing from containerized services
Below is the docker compose file which I used to launch two services, postgres database and django application. Somehow, my data in postgres is disappearing. I am not sure whether it is a Django problem or Postgres problem. It doesn't get disappear quickly, after couple of days suddenly I am seeing nothing in the database. Even the django superuser getting disappear. But the docker services are still running. docker compose ls shows the services. version: "3.9" services: db: image: postgres:11 volumes: - pgdata:/var/lib/postgresql/data environment: - PRODUCTION=false - POSTGRES_HOST_AUTH_METHOD=trust - PGDATA=/var/lib/postgresql/data env_file: - ./config/.env.dev ports: - "5435:5432" web: build: . command: > sh -c "/wait-for-it.sh db:5432 -- python manage.py migrate && python manage.py runserver 0.0.0.0:80" volumes: - .:/code - ./wait-for-it.sh:/wait-for-it.sh environment: - PRODUCTION=false env_file: - ./config/.env.dev ports: - "80:80" depends_on: - db volumes: pgdata: -
Cannot add author field in django
but when i'm making python manage.py makemigrations, it says that nothing has changed and in admin panel i only have title and body fields, but not author, can you please tell me where i did some mistakes? i have that django code in blog/models.py: from django.db import models from django.urls import reverse from django.contrib.auth.models import User # Blog Models class Post(models.Model): title = models.CharField(max_length=200) author = models.ForeignKey(User, on_delete=models.CASCADE), body = models.TextField() def __str__(self): return self.title def get_absolute_url(self): return reverse("post_details", kwargs={"pk": self.pk}) -
How to model biderection relation with a django model?
I have three simple models : Country, state, cities A country has several states A states has severals cities, and only one country A cities has one state I'd like to model this using django class Country(models.Model): name = models.CharField() ... States ??? class State(models.Model): name = models.CharField() country = models.ForeignKey(City, on_delete=models.CASCADE) ... Cities ??? class City(models.Model): name = models.CharField() State = models.ForeignKey(State, on_delete=models.CASCADE) I'm am not very clear about how to represent the links between state and country, as well as the link between state and cities, since there is no "OneToMany" class. Additionnaly, I'd like it to be biderectionnal (I'd like to be able to access the state from the cities, as well as the cities from the states and so on..) How to to that ? -
django-comments-xtd clashing with wagtail-localize
I am following the official tutorial for wagtail-localize, and I am at the step to set up a second locale. When I hit save, I get: DoesNotExist at /admin/locales/new/ XtdComment matching query does not exist. Request Method: POST Request URL: http://127.0.0.1:8000/admin/locales/new/ Django Version: 4.2.2 Exception Type: DoesNotExist Exception Value: XtdComment matching query does not exist. How can I prevent django-comments-xtd to get involved here at all? I am using the latest versions of both packages: Django>=4.2,<4.3 wagtail>=5.0.2,<5.1 django-comments-xtd==2.9.10 wagtail-localize==1.5.1 Thank you! EDIT: I CAN actually create a new locale if I do not synchronize it from my default one. When I then try to edit the new locale to enable synchronization, I get the same error again. -
Djangocms-blog Reverse for 'post-detail' not found in another languages
I wrote a cms plugin that show a blog details and link. it work's on the EN language but in FA post.get_absolute_url() has a error, that says: Reverse for 'post-detail' not found. 'post-detail' is not a valid view function or pattern name. I'm using djangocms-blog==1.2.3, django==3.2.20 and djangocms==3.11.3 My models.py: class ArticleView(CMSPlugin): post = models.ForeignKey(Post, on_delete=models.CASCADE, related_name="article_view")` My cms_plugins.py: @plugin_pool.register_plugin class ArticleViewPlugin(CMSPluginBase): model = ArticleView name = _("Article View Plugin") render_template = "article_view.html" cache = False In my article_view.html: <a class="fusion-link-wrapper" href="{{ instance.post.get_absolute_url }}"aria-label="{{ instance.post.title }}"></a> My urls.py: from cms.sitemaps import CMSSitemap from django.conf import settings from django.conf.urls.i18n import i18n_patterns from django.conf.urls.static import static from django.contrib import admin from django.contrib.sitemaps.views import sitemap from django.urls import include, path admin.autodiscover() urlpatterns = [path('sitemap.xml', sitemap, {'sitemaps': {'cmspages': CMSSitemap}}), path('', include('djangocms_blog.taggit_urls')),] urlpatterns += i18n_patterns(path('admin/', admin.site.urls), path('', include('cms.urls')), path('taggit_autosuggest/', include('taggit_autosuggest.urls'))) if settings.DEBUG: urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT ) urlpatterns += static(settings.STATIC_URL, document_root=settings. STATIC_ROOT) error image: I tried to change languages in settings and rebuild the FA page but nothing happened -
Module not found in django
I have a django project with the following structure: game_app lobby_app __init__.py lobby_serializers.py user_app __init__.py user_serializers.py manage.py When I try to import user_serializers/UserSerializer into lobby_serializers.py with from game_app.user_app.user_serializers import UserSerializer I receive module not found from Python. Why is that? I've tried all kinds of import statements, relative, absolute, etc. and I always receive module not found or relative import beyond top level package error. -
How to properly manage CSRF with a React frontend and a Django backend
Ive found that, using Django, CSRF tokens are required under scenarios (and should in general be): For all incoming requests that are not using HTTP GET, HEAD, OPTIONS or TRACE, a CSRF cookie must be present, and the ‘csrfmiddlewaretoken’ field must be present and correct. If it isn’t, the user will get a 403 error. I have found a great deal of documentation and examples relevant only when Django is rendering the page templates. In this case, your templates can use special {% csrf_token %} token to add a hidden field that, when submitted, allows the backend to effectively validate the form's origin. So how does this generally work when Django is not rendering the pages? I can contrive a simple example where the frontend just uses React and the backend is strictly an API. I've found other documentation that claim you can decorate your backend API methods with such things as @csrf_protect or @ensure_csrf_cookie. However, the decorators instruct Django to set CSRF tokens on backed replies for some view/API request. Imagine a simple "login" type of scenario: React frontend renders Login page with form React frontend submits form with PUT to backend for auth According to any docs or … -
Django project: Failed to load resource: the server responded with a status of 404 (Not Found) error for media files
My website was working fine in both development and production, until I tried to add a google analytics tag to the website which I did incorrectly at first (accidentally put it outside of the head element). After doing this, my site started throwing the above 404 error for every media file it tried to load in production, even though the media files are all in the location that the site seems to be trying to access. The site also works perfectly fine in development with the exact same setup. Here is the full error I am receiving for every media file on my site: media_file.ext Failed to load resource: the server responded with a status of 404 (Not Found) Below are the relevant parts of my settings.py: BASE_DIR = Path(__file__).resolve().parent.parent MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') and in my urls.py of my project I have included: urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) I tried both putting the google analytics tag in the head element, which did not work, and then taking the google analytics tag out, which also did not work. I have also tried re-adding the media files to my database by changing the images associated with each django object, … -
error: expected an identifier. expected a valid attribute name
{% for product in product %} <div class="col-xs-3 col-sm-3 col-md-3"> <div class="card" style="width: 18rem;"> <img src='/media/{{ product.get("image") }}' class="card-img-top" alt="..."> <div class="card-body"> <h5 class="card-title">{{ product.get("product_name") }}</h5> <p class="card-text">{{ product.get("desc") }}</p> <button id="pr{{product.get("id")}}" class="btn btn-primary cart">Add To Cart</button> </div> </div> </div> I was building a Django e-com platform and now I am getting this error for the image src tag ERROR: Expected an identifier. |Expected a valid attribute name, but instead found " ' ", Which is not part of a valid attribute name. How to fix this error? -
How to get hotels near a location using Google places api in a django framework?
I am working on a project using django framework. I want to use google places api to get hotels near a location(location as an input from the user). How to do that? I am new to django framework and integrating different APIs and there is not much information about this anywhere.