Ask coding questions

← Back to all posts
Testing flask
yossarian0022 (0)

When testing flask from the quick start quide ;(

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':'', port=8080)

a5rocks (502)

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.