Saturday, August 7, 2021

Django sqlite Migration error

Error : django.db.utils.OperationalError: no such table: main.auth_user__old

Solution :
Do not use Django 2.0.0 with sqlite database. The issue is fixed in later versions of Django.
Django 2.1.5 does not have this error.

pip install django==2.1.5

Google Drive api uploads file name as "Untitled"

If you are uploading a file on google drive using Google API, you might face incorrect filename issue. If uploaded filename is not the real name of the file, its name is Untitled, here is the solution for you.

You need to send metadata json with the post data. Metadata json contains filename and content type. When google api finds metadata json with the post data, it uploads the file with correct name.

Here is the tutorial to upload the file on the google drive using postman.

https://linuxamination.blogspot.com/2021/08/upload-files-on-google-drive-using.html

If you are using curl or any other scripting method to upload the files on drive, you need to send metadata json with the post data.

It will solve the issue.

Complete Solution :



Upload Files on Google Drive using Postman


SR. No.
Parameter Value
1
Request Type Post
2
URL https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart
3.1 Authorization Authorization Type Oauth2.0
3.2
Available Token <here-is-the-token>
3.3
Token Name Authorization
3.4
Grant Type Authorization Code
4.1 Headers Authorization Bearer <here-is-the-token>
4.2
Content-Type multipart/form-data; boundary=<calculated when request is sent>
4.3
Content-Length <calculated when request is sent>
4.4
Host <calculated when request is sent>
5.1 Body Key Empty
5.2
File filename.json
5.3
Key Empty
5.4
File file.png

Screenshots : (Click on image to see bigger view)


 



a) filename.json

    Content-Type: application/json; charset=utf-8
    {
      "name": "file.png",
      "mimeType": "image/png"
    }

b) file.png

    An image file