I want to import an existing SQLite database. However, when I try to drag it into Glitch, it just gets uploaded to the assets. And when I try to use the template from my GitHub repo, suddenly the tables no longer exist, despite it being fine when I download the file locally. Any way to import an existing SQLite file?
I tried to reproduce this issue, however, I was not able to.
You can perhaps upload the file from assets folder into a different folder and access it from there:
- Go to the assets folder in your project and select the image you want to upload locally to your Glitch project. Click on the ‘Copy URL’ button. This will copy an image URL like
https://cdn.glitch.com/f6254aa9-8051-48db-bbc1-5e7766f748c5%2Fw6.jpg?1531238960521to your clipboard. How to access ‘Assets’ drawer
- Go to the ‘Console’ in Glitch, and if you don’t already have an assets folder, type
mkdir assetsand hit enter. (How to access Console on Glitch editor
cd assetsand hit enter to move into the assets folder.
wgetand then paste the image URL, you copied previously into the console, so you see something like
wget https://cdn.glitch.com/f6254aa9-8051-48db-bbc1-5e7766f748c5%2Fw6.jpg?1531238960521and hit enter. That’ll import that image to your assets folder. Note that it’ll be imported with the name
f6254aa9-8051-48db-bbc1-5e7766f748c5%2Fw6.jpg?1531238960521. To make it easier to deal with you’ll want to rename it. To do so, type
mv /app/assets/f6254aa9-8051-48db-bbc1-5e7766f748c5%2Fw6.jpg?1531238960521 /app/assets/w6.jpgand hit enter. You can confirm the asset renamed correctly by typing
ls -aland you’ll see a list of files, one of which should be called
- Repeat steps 1 and 4 for each image you want to upload. Be sure to change the name of the file to the relevant one in step 4.
The path you’ll then use is:
__dirname + '/assets/w6.jpg'