I wrote flask web which I was testing by running the server like ‘python src/run.py’
Now recently I decided to use flask cli approach.
So I did ‘export FLASK_APP=src/run.py‘
then ‘flask run‘ it work starts web app at 5000 by default but nothing opens in browser.
I do not get any error. Do I have to create FlaskGroup to create flask cli run command explicitly?
Related
I have been looking into adding oTree to a website hosted in Windows 2012 IIS on a Windows 10 VM.
To run locally I just run otree prodserver inside the directory of the apps folder.
The app runs on localhost:8000 unless specified otherwise, which allows me to generate unique urls for players on the local network.
When looking at attaching to the IIS so it can get ran using a URL on the cloud remotely, not sure how to go about it.
With Django attaching the wsgi and enabling it to the IIS. Inside oTree no file exist. It seems to use Uvicorn and Scarlett to run asynchronously with ASGI server.
From what I can tell it would be easiest to use Hypercorn and run it with a web.config file. But that's where I am lost.
I'm not sure where the ASGI module/app is to execute with Hypercorn.
Can I just run a CLI with otree prodserver and attach that to Hypercorn to host the localhost:8000 on the IIS with a proxy?
I have a web app made with Flask and I want to host it on GitHub pages. However, GitHub pages can't run Python apps, and I can't use something like Frozen-Flask because my app is dynamic.
Background: I am new to Flask (and fairly new to python, linux terminal, servers). I have gone through the tutorial http://flask.pocoo.org/docs/1.0/tutorial/.
I am developing on raspberry pi 3, via putty from my PC.
I run flask, according to the tutorial:
export FLASK_APP=flaskr
export FLASK_ENV=development
flask run
According to the tutorial I can make changes to the code and the server will automatically reload.
My issue: I don't know how to make changes to my code without stopping Flask (ctrl+c).
How can I leave Flask, return to the Linux Terminal, edit my code, and then return to the Flask Debugger without stopping Flask each time?
I have reviewed the Flask Docs http://flask.pocoo.org/docs/1.0/ to no avail.
Thanks,
You has to enable the debug mode. Default debug is True in flask
app.run(debug=True) or export DEBUG=True
you can go through this link for Flask configuration
http://flask.pocoo.org/docs/1.0/config/#configuring-from-environment-variables
If you are using Flask >=1.0v you need to set environment in development mode.
export FLASK_ENV='development'
I'm new to web development and deployment however I developed a web site using Python 2.7 and Flask. I can't get the site to load when the user hits the site. When testing on the server using SSH the program starts like it did on my development PC but does not render the first template and shows this error: WARNING: Do not use the development server in a production environment. Use a production WSGI server instead.
In researching that error I found an article that says Flask is not meant for a multi-user public web environment. Further investigation said: If you want to run Flask in production, be sure to use a production-ready web server like Nginx, and let your app be handled by a WSGI application server like Gunicorn.
I think what this is telling me is:
Find a provider that supports Nginx.
Install Gunicorn and then configure it to run on that host.
Doing that should allow my program to run on the host server and be accessible to the world.
Would folks with experience with Python/Flask web apps please confirm the direction I should be heading as I can't afford to go down the wrong path again.
Can anyone let me know how to deploy a flask app on a personal website using CPanel
I have tried running it through the virtualenv but did not work
Flask is a micro framework that runs in a Python instance, and not as a set of files that are served from a web server, like HTML or PHP. Most likely you will need another hosting provider that hosts web applications like Heroku or use a VPS instead.
On the other hand, most shared hosting providers do not allow you to install custom libraries that need to be compiled.