
from website.app import init_app

app = init_app('website.settings', set_backends=True, routes=True)

if __name__ == '__main__':
    app.run(host='127.0.0.1', port=5000)

import os

from website.app import init_app

app = init_app('website.settings', set_backends=True, routes=True)

if __name__ == '__main__':
    host = os.environ.get('OSF_HOST', None)
    port = os.environ.get('OSF_PORT', None)
    app.run(host=host, port=port)

Make host and port configurable thru envvars
Make host and port configurable thru envvars

+ import os
  
  from website.app import init_app
  
  app = init_app('website.settings', set_backends=True, routes=True)
  
  if __name__ == '__main__':
-     app.run(host='127.0.0.1', port=5000)
+     host = os.environ.get('OSF_HOST', None)
+     port = os.environ.get('OSF_PORT', None)
+     app.run(host=host, port=port)
  
Make host and port configurable thru envvars
## Code Before:

from website.app import init_app

app = init_app('website.settings', set_backends=True, routes=True)

if __name__ == '__main__':
    app.run(host='127.0.0.1', port=5000)

## Instruction:
Make host and port configurable thru envvars
## Code After:
import os

from website.app import init_app

app = init_app('website.settings', set_backends=True, routes=True)

if __name__ == '__main__':
    host = os.environ.get('OSF_HOST', None)
    port = os.environ.get('OSF_PORT', None)
    app.run(host=host, port=port)
