1
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)

@app.route('/')
def hello_world():
return 'Hello, Repler!'

@app.route('/secure-page')
def secret_route():
password = request.args.get('secret')
if (password == os.environ['PASSWORD']):
return 'You found the secret!'
else:
return 'Wrong password!'

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

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

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

import python_dotenv

python_dotenv.load_dotenv()

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