-2

How can I set my DATABASE_URL as an environment variable in Python on Windows?

1
  • 1
    Do you have an example or a specific issue? You will be more likely to receive an answer if you post some code. Environment variables are available in the os module in os.environ Commented Jun 16, 2020 at 4:23

1 Answer 1

0

With the os module of the standard library;

>>> import os
>>> os.environ.get('NON_EXISTANT')
None
>>> os.environ.get('HOME')
/home/username

If you want to set such a variable;

>>> os.environ['YOUR_VARIABLE'] = 'your_value'

Note: print all available environment variables with os.environ.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.