Testing flask
yossarian0022 (0)

When testing flask from the quick start quide ;(https://repl.it/site/docs/misc/quick-start)

with the .env file, it will not run it gives a tip , do a pip install of python-dotenv

I installed the package but it still will not run?

this is the code

from flask import Flask, request
import os
app = Flask(name)

def hello_world():
return 'Hello, Repler!'

def secret_route():
password = request.args.get('secret')
if (password == os.environ['PASSWORD']):
return 'You found the secret!'
return 'Wrong password!'

if name == 'main':
app.run(host='', port=8080)

You are viewing a single comment. View All
a5rocks (528)

That should work. Though, if you are using the python-dotenv module, you should add this code:

import python_dotenv


But anyway, your code should work since repl automatically loads the variables in your .env file.