Bhupesh-V / tutorialdb

A search 🔎 engine for programming/dev tutorials,
MIT License
121 stars 60 forks source link

LOCAL_HOST is not optional #96

Open ObliviousParadigm opened 4 years ago

ObliviousParadigm commented 4 years ago

Is your feature request related to a problem? Please describe. The README.md file specifies that adding LOCAL_HOST is optional but I am facing an issue on my desktop. I can't run the code without adding localhost.

Describe the solution you'd like I have fixed this issue. I have already sent a PR. #95

kalumewakitsao commented 2 years ago

This could be fixed by using os.getenv i.e.

import os

ALLOWED_HOSTS = [
    '127.0.0.1',
    'tutorialdb.pythonanywhere.com',
    'tutorialdb-app.herokuapp.com'
    'tutorialdb-app.herokuapp.com',
]

LOCAL_HOST = os.getenv('LOCAL_HOST')

if LOCAL_HOST:
    ALLOWED_HOSTS.append(LOCAL_HOST)