Reputation: 1374
I am new to web development and git. I have created a project which i have hosted on pythonanywhere.com. I pushed my code to github and then cloned it to pythonanywhere. I have some information in my settings.py file which i want to hide on github. So how can i make changes to the project on my local machine and update it on github and from there to pythonanywhere without revealing the hidden info.
As i said i am new to using git, so i am unaware of many tools that come with it. What is the proper way to do this?
Upvotes: 3
Views: 123
Reputation: 1267
Simple solutions is:
settings_local.py
near your settings.py
settings_local.py
add following code to import sensitive settings to settings.py
:
try:
from .settings_local import * # noqa
except ImportError:
pass
add settings_local.py
to .gitignore
so git would exclude it from commits
settings_local.py
on pythonanywhere and your local machine manually or with some scriptUpvotes: 4