Reputation: 11
I have a simple Flask app that runs on DigitalOcean App Platform with the run command: gunicorn --worker-tmp-dir /dev/shm --config gunicorn_config.py app:app
I would like to test this locally in my virtual environment before pushing it to GitHub. What is the proper way to start the app locally with a python command (without messing up the way it runs on App Platform)?
Upvotes: 1
Views: 5609
Reputation: 1
here you go, i setup a flask postgres starter project for digital ocean app platform:
https://github.com/heyaustinwood/flask-do-app-platform
You can set it up and then run it locally first before you setup the project in digital ocean by following the steps in the readme
Upvotes: 0
Reputation: 208
Create venv:
python -m venv venv
Activate venv:
source venv/bin/activate
Install Flask:
pip install flask
Create flask app in main.py (or use your own)
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello_world():
return "<p>Hello, World!</p>"
Run your app:
set FLASK_APP=main # write your script name (my is main.py)
flask run # * Running on http://127.0.0.1:5000/
Open your browser on http://127.0.0.1:5000/
More information in official documentation
Upvotes: 1