Posts

Showing posts from April, 2020

How to get Full URL or get absolute url In Django

this is use full to get full url for images or files. getting: [     {          "id" :  1 ,          "photo_url" :  "/media/media/11_sUhP0CC.png"     } ] Need: (after apply below process we get full url) [     {          "id" :  1 ,          "photo_url" :  "http://localhost:8000/media/media/11_sUhP0CC.png"     } ] Existing code: models.py class Car ( models . Model ): name = models . CharField ( max_length = 255 ) price = models . DecimalField ( max_digits = 5 , decimal_places = 2 ) photo = models . ImageField ( upload_to = 'cars' ) serializers.py class CarSerializer ( serializers . ModelSerializer ): class Meta : model = Car fields = ( 'id' ...

Reactjs Login with Google

// import React, { Component } from 'react'; // class App extends Component { //     componentDidMount() { //         this.googleSDK(); //         console.log('sfsfd'); //     } //     prepareLoginButton = () => { //     console.log(this.refs.googleLoginBtn); //     this.auth2.attachClickHandler(this.refs.googleLoginBtn, {}, //         (googleUser) => { //         let profile = googleUser.getBasicProfile(); //         console.log('Token || ' + googleUser.getAuthResponse().id_token); //         console.log('ID: ' + profile.getId()); //         console.log('Name: ' + profile.getName()); //   ...

TemplateDoesNotExist Error in Django Project - how to Slove

TemplateDoesNotExist at /login/ login.html   Request Method: GET Request URL: http://127.0.0.1:8000/login/ Django Version: 3.0.5 Exception Type: TemplateDoesNotExist Exception Value: login.html Exception Location: /home/cit246/Desktop/venkat/assessmentproject/assenv/lib/python3.6/site-packages/django/template/loader.py in get_template, line 19 Python Executable: /home/cit246/Desktop/venkat/assessmentproject/assenv/bin/python3.6 Python Version: 3.6.10 Python Path: ['/home/cit246/Desktop/venkat/assessmentproject/assessmentproject', '/home/cit246/Desktop/venkat/assessmentproject/assessmentproject', '/home/cit246/Desktop/venkat/assessmentproject/assenv/lib/python36.zip', '/home/cit246/Desktop/venkat/assessmentproject/assenv/lib/python3.6', '/home/cit246/Desktop/venkat/assessmentproject/assenv/lib/python3.6/lib-dynload', '/usr/lib/python3.6', '/home/cit246/Desktop/venkat/assessmentproject/assenv/lib/python3.6/site-pack...