Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Making Our Project Production-ready

Christopher Stuart
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Christopher Stuart
Full Stack JavaScript Techdegree Graduate 27,771 Points

Not working

Having some serious problems now---made it this far--but i can see a lot seems to be outdated maybe ? Whatever the case after creating the get_env_variable function--i cant push the files.

Traceback (most recent call last):
remote:          File "manage.py", line 10, in <module>
remote:            execute_from_command_line(sys.argv)
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
remote:            utility.execute()
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 302, in execute
remote:            settings.INSTALLED_APPS
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/conf/__init__.py", line 55, in __getattr__
remote:            self._setup(name)
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/conf/__init__.py", line 43, in _setup
remote:            self._wrapped = Settings(settings_module)
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/conf/__init__.py", line 99, in __init__
remote:            mod = importlib.import_module(self.SETTINGS_MODULE)
remote:          File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
remote:            return _bootstrap._gcd_import(name[level:], package, level)
remote:          File "<frozen importlib._bootstrap>", line 978, in _gcd_import
remote:          File "<frozen importlib._bootstrap>", line 961, in _find_and_load
remote:          File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
remote:          File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
remote:          File "<frozen importlib._bootstrap_external>", line 678, in exec_module
remote:          File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
remote:          File "/tmp/build_eed8432b0de18eecf2fd1f1bf855b033/deploy_settings/__init__.py", line 11, in <module>
remote:            SECRET_KEY = get_env_variable("SECRET_KEY")
remote:          File "/tmp/build_eed8432b0de18eecf2fd1f1bf855b033/dealmazing/settings.py", line 20, in get_env_variable
remote:            return os.environ(var_name)
remote:        TypeError: '_Environ' object is not callable

2 Answers

Igor Kozhevnikov
Igor Kozhevnikov
8,333 Points

Seems like it says an os.environ object is not callable. In Python docs, it says: "A mapping object representing the string environment. For example, environ['HOME'] is the pathname of your home directory (on some platforms), and is equivalent to getenv("HOME") in C." Try to change the line return os.environ(var_name) to return os.environ[var_name], maybe it'll fix the issue.