How to setup Flask-Admin
michaeltoohig opened this issue · 5 comments
I would like to add Flask-Admin to my backend. When trying to access the /admin
endpoint I get a blank page but with the frontend
stopped I get a 404.
To test I've added to app_setup.py
the following below where sentry
is initialized.
from flask_admin import Admin
admin = Admin(app, name=f"{config.PROJECT_NAME}", template_mode="bootstrap3")
I'm just kinda lost as to what needs to be changed. Any help is much appreciated.
I found a solution but not yet if its a complete solution.
Adding the following to backend
-> labels
in docker-compose.dev.labels.yml
works.
- traefik.frontend.rule=PathPrefix:/admin
Edit This seems to overwrite the rule preceding it which was for /api
.
Edit 2 This issue addresses my question traefik/traefik#419
Just needed to comma separate the two endpoints.
- traefik.frontend.rule=PathPrefix:/admin, /api
Awesome! Thanks for sharing the solution.
I do have a question related to this. I have had a hard time trying to add rules that would make traefik bypass specific subdomains or paths to services not in this project/swarm. Is that even possible?
Thanks.
@michaeltoohig sorry for the delay, if I understand the problem, yes, you can have a global Traefik in the Docker Swarm cluster that handles several domains for several stacks.
And then, each stack will have its own domain(s), and its own internal (intra-stack) Traefik proxy.
The global Traefik can be set up following DockerSwarm.rocks
And the internal stacks can be generated with this project generator or all the "siblings".
For example, using the new FastAPI you could generate the projects with:
Hi @michaeltoohig , I'll assume you were able to solve your problem and I'll close this issue now.
If you are still using this project, I suggest you check the equivalent project generator for FastAPI that solves the same use cases in a much better way.
Because of that, this Flask-based project generator is now going to be deprecated. You are still free to use it, but it won't receive any new features, changes, or bug fixes.