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' ...
I worked on converting HTML formate to PNG Image using python, its take 1 week to complete, First, I tried with Imgkit Package then I tried with Html2image Package, Later I tried with Pypperteer Package, When I used Imgkit package, I faced on one issue what it means, in HTML file we have any embedded code or more loading javascript code, its take more than 5 sec so when I used imgkit it is not taking those things on the image. when I used Html2image Package, I faced the same issue Finally, I solved that loading issue using Pypperteer Package ( https://github.com/pyppeteer/pyppeteer ), In Pypperteer Package we have one option, by using that option we can stop converting into the image until load the complete HTML file, And here we have one more great option to pass HTML string to get Document Elements like OffsetHight, etc. import asyncio from pyppeteer import launch def converting_html_image(input_url) -> str: file_na...
pyrebase python documentation or how to Connect Firebase For Authenticate and Database Usage If you do not Install then install using "pip install Pyrebase" Add Pyrebase to your application For use with only user based authentication we can create the following configuration : import pyrebase config = { "apiKey" : "apiKey" , "authDomain" : "projectId.firebaseapp.com" , "databaseURL" : "https://databaseName.firebaseio.com" , "storageBucket" : "projectId.appspot.com" } firebase = pyrebase.initialize_app(config) We can optionally add a service account credential to our configuration that will allow our server to authenticate with Firebase as an admin and disregard any security rules. create project using Firebase -- https://console.firebase.google.com/ import pyrebase config = { "apiKey" : "apiKey" , "authDomain" : "projectId.firebaseapp.com" , ...
Comments
Post a Comment