0

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 2

0

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-redis

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your answer. Re: redis, my apologies that was a bad example. Actually we use Qdrant, and we have a working docker-compose.qdrant.yaml already - it works very nicely! I'm also leaning towards keeping the python-flask in a separate project, but I'm having issues with the ddev python quickstart - the health-check times out waiting for the web container, which never successfully loads... thanks for your invitation, i'll bring this to the Discord channel!
Python + gunicorn can be tricky because the settings have to be right or it fails on startup. I should be able to help you with this in Discord, especially if you have a simple project I can use to recreate the issue.
0

Create 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.

 flask:
    build: ./pathto/flaskapplication
    ports:
      - '5000:5000'

Start DDEV ddev start

Access Flask app at http://myproject.ddev.site:5000

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.