Skip to content
Sign upLog in
← Back to Community
initialising flask app from the command line
Profile icon
EthanHorsfall

Hello! :)

I have been going through the flask app tutorial. When I ran from my own computer, everything worked fine. However, I have run into some problems initializing the server on repl.

Unlike the other tutorials i found on the repl website, the tutorial on the flask documentation initiated from the command line, with:

export FLASK_APP=flaskr
export FLASK_ENV=development
flask run

This (normally) works (but stopped working briefly), and runs when I open a new tab http://127.0.0.1:5000/, but it doesn't allow me and my friend to open it at the same time.

I have also tried
export FLASK_APP=flaskr
export FLASK_ENV=development
flask run --host='0.0.0.0'

This did work, but then stopped working. The error message is that this site cannot be reached

I then tried
export FLASK_APP=flaskr
export FLASK_ENV=development
flask run --host='0.0.0.0' --port=8080.
This gives the error that there is no module named 'flaskr', which is confusing, because from what I can tell, this is what the FLASK_APP=flaskr is meant to tell the flask application

sorry in advance for my own incompetence:))

Answered by Coder100 [earned 5 cycles]
View Answer
Voters
Profile icon
EthanHorsfall
Comments
hotnewtop
Profile icon
Coder100

Yes. You must set it as the default command repl runs.
Create a .replit file:

run = """ ... """

replace ... with the command you wanted to run (that flaskr run thing)

Profile icon
EthanHorsfall

@Coder100
thank you. I wrote the file. when i run it i get the same bugs as before?

Profile icon
Coder100

Strange, try forking the repl.
https://repl.it/bugs

@EthanHorsfall

Profile icon
EthanHorsfall

@Coder100
ok thank you for your time:)

Profile icon
Coder100

np :) mark as correct answer?

@EthanHorsfall

Profile icon
EthanHorsfall

@Coder100
on stack exchange i got given the advice to:
"First, make the export variables global by placing it in ~/.profile. Create a python3 virtualenvrinment and install respective libraries in it. after that try to run your flask app. it should work if there is no coding issue"

Do you know how to find the ~./profile on repl?

Profile icon
Coder100

@EthanHorsfall
sorry, that's something that you don't have access to on repl.it, unfortunately