I have a ddev-Drupal project and want to add web-routing for my python-flask project. Ideally something like this: https://github.com/docker/awesome-compose/tree/master/flask-redis – or maybe with gunicorn? In the end i want the flask-app to run at http:myproject.ddev.site:5000 or similar…
2
Answers
My recommendation would be to use two projects, one for your Drupal PHP project, and the other for your flask project.
They can easily communicate with each other as described in the FAQ
The Drupal project is just standard, easy setup, per the quickstart docs.
Your Flask project can also be set up using the quickstart docs
Now wire them together and it should be OK. Come on by the DDEV Discord if you need more interactive help. This is an unusual configuration!
Edit: I’m not sure why you’d be using flask for Redis. Have you checked out the
ddev-redis
add-on? https://github.com/ddev/ddev-redisCreate a flask app with a Dockerfile specifying Gunicorn as the server
example:
gunicorn --bind 127.0.0.1:5000 appserver:gunicorn_app
Then add the flask service to your DDEV project’s docker-compose.yaml mapping port 5000
replace ./pathto/flaskapplication with path of your Flask application directory This one to setup alongside your Drupal service.
Start DDEV
ddev start
Access Flask app at http://myproject.ddev.site:5000