简体   繁体   中英

Having trouble getting Heroku to detect a json file in a Flask app

Sorry if the question is too dumb. Been trying to deploy a Flask app in Heroku but getting an error that says Heroku is not finding a json file I have in my root directory. users_data_db.json This file has dummy user login data so i have it in a git ignore file. I assume this is why Heroku may not be able to read the file? What would be my alternative? I dont mind pulling out the file from the git ignore if i need to as the data is placeholder/fake passwords.

The error logs after running heroku logs --tail are:

2020-08-20T00:10:11.527823+00:00 app[web.1]: File "/app/model.py", line 14, in load_user_db
2020-08-20T00:10:11.527824+00:00 app[web.1]: with open("users_data_db.json") as f:
2020-08-20T00:10:11.527824+00:00 app[web.1]: FileNotFoundError: [Errno 2] No such file or directory: 'users_data_db.json'
2020-08-20T00:10:11.528063+00:00 app[web.1]: [2020-08-20 00:10:11 +0000] [10] [INFO] Worker exiting (pid: 10)
2020-08-20T00:10:11.672038+00:00 app[web.1]: [2020-08-20 00:10:11 +0000] [4] [INFO] Shutting down: Master
2020-08-20T00:10:11.672225+00:00 app[web.1]: [2020-08-20 00:10:11 +0000] [4] [INFO] Reason: Worker failed to boot.
2020-08-20T00:10:11.757052+00:00 heroku[web.1]: Process exited with status 3
2020-08-20T00:10:11.798465+00:00 heroku[web.1]: State changed from up to crashed

My root tree structure:

- __pycache__
- .vscode
- static
- templates
- venv
- .gitignore
- app.py
- model.py
- notes_data_db.json
- Procfile
- README.md
- requirements.txt
- runtime.txt
- user.py
- users_data_db.json

my repo

thanks!

It might be because user_data_db.json does not exist in your repo?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM