I created simple django project and i stored secret key, variable etc. in keys.json file. It gives this error when i try to build project:
FileNotFoundError: [Errno 2] No such file or directory: 'keys.json'
How can i fix it.
My.travis.yml file:
python:
- "3.7"
install:
- pip install -r requirements.txt
script:
- python manage.py test
- python manage.py runserver 0.0.0.0:8000
I am not an expert on travis ci
so this is probably not an ideal solution, but one way of solving this problem could be to add the file as an environmental variable.
Lets say keys.json looks like this:
{
"secret_key": {
"plsd0nth4ckme"
}
}
Its unix string representation of it looks like this:
'{\n "secret_key": {\n "plsdnth4ckme"\n }\n}\n'
And then add this string as an environmental variable:
Now you can make the file in for instance the install step by adding
printf $KEYS > keys.json
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.